This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Send Error Code from Kernel Space to User Space.

Hi All,

I get an Error Code during Configuration set up of USB for rare USB drive.

below is the error Message Printed on uart

usb 2-1: new high speed USB device using fsl-ehci and address 28

usb 2-1: can't set config #1, error -71

usb 2-1: USB disconnect, address 28 hub 2-0:1.0: unable to enumerate USB device on port 1

This is the code

        c = usb_choose_configuration(usb_dev);
        if (c >= 0) {
                result = usb_set_configuration(usb_dev, c);
                if (result) {
                        dev_err(&usb_dev->dev,
                                "can't set config #%d, error %d\n", c, result);
                        /* This need not be fatal.  The user can try to
                         * set other configurations. */
                }
        }
        dev_info(&usb_dev->dev, "authorized to connect\n");

I want to send this error code to USER SPACE.

The Possible Implementations i thought of Is

> IOCTL

> Signal from Kernel to User Space

> dmesg read

Can anybody suggest the efficient mechanism to do this.