Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why USB Device gets disconnected immediately after successful probe

I am learning how to write kernel module for USB devices, i changed the usb_skeleton sample found in 'drivers/usb_skeleton.c' according to VID/PID of my USB device. I was able to insert the module successfully using insmod. After plugging in, the device probe function is being called and it returns successfully, but immediately after that disconnect function gets called.

when i try to lsmod(the device is still plugged in) it shows that driver is not being used by any device.

dmesg after insmod:

[ 207.206082] usb_skeleton: module verification failed: signature and/or required key missing - tainting kernel

[ 207.206451] usbcore: registered new interface driver skeleton

dmesg after device plugged in:

[ 275.794675] skeleton 1-1.2:1.0: USB Skeleton device now attached to USBSkel-1

[ 275.946207] usb 1-1.2: usbfs: interface 0 claimed by skeleton while 'brltty' sets config #1

[ 275.946924] skeleton 1-1.2:1.0: USB Skeleton #1 now disconnected

please guide me what is going wrong to cause the device to be disconnected.

like image 740
user2853571 Avatar asked Oct 17 '25 03:10

user2853571


1 Answers

I had a similar issue with USB2COM port device which can't be used by this problem

 [ 9151.973716] usb 1-2: New USB device found, idVendor=10c4, idProduct=ea60, bcdDevice= 1.00
 [ 9151.973725] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
 [ 9151.973729] usb 1-2: Product: CP2102 USB to UART Bridge Controller
 [ 9151.973734] usb 1-2: Manufacturer: Silicon Labs
 [ 9151.973737] usb 1-2: SerialNumber: 0001
 [ 9151.983703] cp210x 1-2:1.0: cp210x converter detected
 [ 9151.985659] usb 1-2: cp210x converter now attached to ttyUSB0
 [ 9153.682634] usb 1-2: usbfs: interface 0 claimed by cp210x while 'brltty' sets config #1
 [ 9153.683638] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
 [ 9153.683694] cp210x 1-2:1.0: device disconnected

 $ lsusb 
 Bus 001 Device 022: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP2102/CP2109 UART Bridge Controller [CP210x family]
 $  lsusb -v -d 10c4:ea60
 Bus 001 Device 022: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP2102/CP2109 UART Bridge Controller [CP210x family]
 Couldn't open device, some information will be missing
 Device Descriptor:
 bLength                18
 bDescriptorType         1
 bcdUSB               1.10
 bDeviceClass            0 
 bDeviceSubClass         0 
 bDeviceProtocol         0 
 bMaxPacketSize0        64
 idVendor           0x10c4 Cygnal Integrated Products, Inc.
 idProduct          0xea60 CP2102/CP2109 UART Bridge Controller [CP210x family]
 bcdDevice            1.00
 iManufacturer           1 
 iProduct                2 
 iSerial                 3 
 bNumConfigurations      1
 Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0020
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
    (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
    bLength                 9
    bDescriptorType         4
    bInterfaceNumber        0
    bAlternateSetting       0
    bNumEndpoints           2
    bInterfaceClass       255 Vendor Specific Class
    bInterfaceSubClass      0 
    bInterfaceProtocol      0 
    iInterface              2 
    Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
        Transfer Type            Bulk
        Synch Type               None
        Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
    Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
        Transfer Type            Bulk
        Synch Type               None
        Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0

So it is visible, but TX regularly at 3-4 seconds blinks. after removeing the driver for braille display driver all normalized. So if someone don't need this driver just remove it.

 sudo apt remove brltty 

Thanks to Chris Stratton for this solution.

like image 102
tedy58 Avatar answered Oct 19 '25 19:10

tedy58