Hi all, As advised, I retried with a more recent kernel (4.2.0), but I get a similar result: I tested via 'echo 1 > /sys/bus/pci/ehci-pci/0000\:00\:1a.0/remove' and 'echo 1 > /sys/bus/pci/rescan'. There are two possible results: no errors when removing the device and then the devices are reinserted with the same ttyUSB number or, with an error: 'usb_wwan_indat_callback: resubmit read urb failed. (-19)' (as shown in the dmesg copied below) and then the numbers increase, even though the ttyUSB devices with the previously used numbers have been removed from /dev. On following attempts the numbers only remain the same or increase, never reusing the freed ttyUSB numbers. Can someone please tell me how I can prevent the error or circumvent the issue otherwise? Sometimes the devices get stuck and resetting them via removal seems to be the only option. Thanks in advance! Erwin [ 623.366025] ehci-pci 0000:00:1a.0: remove, state 1 [ 623.366042] usb usb1: USB disconnect, device number 1 [ 623.366047] usb 1-1: USB disconnect, device number 2 [ 623.366051] usb 1-1.1: USB disconnect, device number 4 [ 623.366270] option1 ttyUSB6: GSM modem (1-port) converter now disconnected from ttyUSB6 [ 623.366294] option 1-1.1:1.0: device disconnected [ 623.368715] option1 ttyUSB9: usb_wwan_indat_callback: resubmit read urb failed. (-19) [ 623.369327] option1 ttyUSB9: usb_wwan_indat_callback: resubmit read urb failed. (-19) [ 623.369863] option1 ttyUSB9: usb_wwan_indat_callback: resubmit read urb failed. (-19) [ 623.370398] option1 ttyUSB9: usb_wwan_indat_callback: resubmit read urb failed. (-19) [ 623.371083] option1 ttyUSB9: GSM modem (1-port) converter now disconnected from ttyUSB9 [ 623.371097] option 1-1.1:1.2: device disconnected [ 623.371315] option1 ttyUSB14: GSM modem (1-port) converter now disconnected from ttyUSB14 [ 623.371330] option 1-1.1:1.3: device disconnected [ 623.371427] qmi_wwan 1-1.1:1.8 ce3p0: unregister 'qmi_wwan' usb-0000:00:1a.0-1.1, WWAN/QMI device [ 623.375567] qmi_wwan 1-1.1:1.8: Error submitting int urb - -19 [ 623.390897] qmi_wwan 1-1.1:1.10 ce3p1: unregister 'qmi_wwan' usb-0000:00:1a.0-1.1, WWAN/QMI device [ 623.411043] usb 1-1.2: USB disconnect, device number 6 [ 623.411240] option1 ttyUSB15: GSM modem (1-port) converter now disconnected from ttyUSB15 [ 623.411260] option 1-1.2:1.0: device disconnected [ 623.413403] option1 ttyUSB17: usb_wwan_indat_callback: resubmit read urb failed. (-19) [ 623.414139] option1 ttyUSB17: usb_wwan_indat_callback: resubmit read urb failed. (-19) [ 623.414905] option1 ttyUSB17: usb_wwan_indat_callback: resubmit read urb failed. (-19) [ 623.415621] option1 ttyUSB17: usb_wwan_indat_callback: resubmit read urb failed. (-19) [ 623.416496] option1 ttyUSB17: GSM modem (1-port) converter now disconnected from ttyUSB17 [ 623.416509] option 1-1.2:1.2: device disconnected [ 623.416706] option1 ttyUSB18: GSM modem (1-port) converter now disconnected from ttyUSB18 [ 623.416719] option 1-1.2:1.3: device disconnected [ 623.416833] qmi_wwan 1-1.2:1.8 ce2p0: unregister 'qmi_wwan' usb-0000:00:1a.0-1.2, WWAN/QMI device [ 623.443063] qmi_wwan 1-1.2:1.10 ce2p1: unregister 'qmi_wwan' usb-0000:00:1a.0-1.2, WWAN/QMI device [ 623.463620] usb 1-1.3: USB disconnect, device number 7 [ 623.575090] ehci-pci 0000:00:1a.0: USB bus 1 deregistered [ 632.292943] pci 0000:00:1a.0: [8086:1e2d] type 00 class 0x0c0320 [ 632.293002] pci 0000:00:1a.0: reg 0x10: [mem 0xafa01000-0xafa013ff] [ 632.293149] pci 0000:00:1a.0: PME# supported from D0 D3hot D3cold [ 632.293368] pci 0000:00:1a.0: System wakeup disabled by ACPI [ 632.293581] pci 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment [ 632.293599] pci 0000:00:1a.0: BAR 0: assigned [mem 0xafa01000-0xafa013ff] [ 632.294363] ehci-pci 0000:00:1a.0: EHCI Host Controller [ 632.294383] ehci-pci 0000:00:1a.0: new USB bus registered, assigned bus number 1 [ 632.294408] ehci-pci 0000:00:1a.0: debug port 2 [ 632.298333] ehci-pci 0000:00:1a.0: cache line size of 64 is not supported [ 632.300000] ehci-pci 0000:00:1a.0: irq 16, io mem 0xafa01000 [ 632.312131] ehci-pci 0000:00:1a.0: USB 2.0 started, EHCI 1.00 [ 632.312244] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 [ 632.312251] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 632.312255] usb usb1: Product: EHCI Host Controller [ 632.312260] usb usb1: Manufacturer: Linux 4.2.0-0.bpo.1-amd64 ehci_hcd [ 632.312265] usb usb1: SerialNumber: 0000:00:1a.0 [ 632.312665] hub 1-0:1.0: USB hub found [ 632.312689] hub 1-0:1.0: 3 ports detected [ 632.624313] usb 1-1: new high-speed USB device number 2 using ehci-pci [ 632.757186] usb 1-1: New USB device found, idVendor=8087, idProduct=0024 [ 632.757196] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 632.757838] hub 1-1:1.0: USB hub found [ 632.758023] hub 1-1:1.0: 6 ports detected [ 633.028778] usb 1-1.1: new full-speed USB device number 3 using ehci-pci [ 633.172905] usb 1-1.1: new high-speed USB device number 4 using ehci-pci [ 633.267635] usb 1-1.1: config 1 has an invalid interface number: 8 but max is 5 [ 633.267647] usb 1-1.1: config 1 has an invalid interface number: 10 but max is 5 [ 633.267654] usb 1-1.1: config 1 has an invalid interface number: 11 but max is 5 [ 633.267662] usb 1-1.1: config 1 has no interface number 1 [ 633.267668] usb 1-1.1: config 1 has no interface number 4 [ 633.267673] usb 1-1.1: config 1 has no interface number 5 [ 633.268645] usb 1-1.1: New USB device found, idVendor=1199, idProduct=68c0 [ 633.268654] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 633.268660] usb 1-1.1: Product: MC7304 [ 633.268665] usb 1-1.1: Manufacturer: Sierra Wireless, Incorporated [ 633.270339] option 1-1.1:1.0: GSM modem (1-port) converter detected [ 633.270744] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB6 [ 633.271012] option 1-1.1:1.2: GSM modem (1-port) converter detected [ 633.271290] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB14 [ 633.271589] option 1-1.1:1.3: GSM modem (1-port) converter detected [ 633.271859] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB15 [ 633.273412] qmi_wwan 1-1.1:1.8: cdc-wdm4: USB WDM device [ 633.273852] qmi_wwan 1-1.1:1.8 wwan0: register 'qmi_wwan' at usb-0000:00:1a.0-1.1, WWAN/QMI device, b6:f0:fe:96:37:0a [ 633.275308] qmi_wwan 1-1.1:1.10: cdc-wdm5: USB WDM device [ 633.275554] qmi_wwan 1-1.1:1.10 wwan1: register 'qmi_wwan' at usb-0000:00:1a.0-1.1, WWAN/QMI device, b6:f0:fe:96:37:0a [ 633.285094] qmi_wwan 1-1.1:1.10 ce3p1: renamed from wwan1 [ 633.305201] systemd-udevd[4892]: renamed network interface wwan1 to ce3p1 [ 633.305893] qmi_wwan 1-1.1:1.8 ce3p0: renamed from wwan0 [ 633.317242] systemd-udevd[4895]: renamed network interface wwan0 to ce3p0 [ 633.345053] usb 1-1.2: new full-speed USB device number 5 using ehci-pci [ 633.489247] usb 1-1.2: new high-speed USB device number 6 using ehci-pci [ 633.588806] usb 1-1.2: config 1 has an invalid interface number: 8 but max is 5 [ 633.588827] usb 1-1.2: config 1 has an invalid interface number: 10 but max is 5 [ 633.588831] usb 1-1.2: config 1 has an invalid interface number: 11 but max is 5 [ 633.588835] usb 1-1.2: config 1 has no interface number 1 [ 633.588838] usb 1-1.2: config 1 has no interface number 4 [ 633.588842] usb 1-1.2: config 1 has no interface number 5 [ 633.590013] usb 1-1.2: New USB device found, idVendor=1199, idProduct=68c0 [ 633.590020] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 633.590024] usb 1-1.2: Product: MC7304 [ 633.590028] usb 1-1.2: Manufacturer: Sierra Wireless, Incorporated [ 633.591811] option 1-1.2:1.0: GSM modem (1-port) converter detected [ 633.592004] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB18 [ 633.592207] option 1-1.2:1.2: GSM modem (1-port) converter detected [ 633.592378] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB19 [ 633.592615] option 1-1.2:1.3: GSM modem (1-port) converter detected [ 633.592773] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB20 [ 633.593629] qmi_wwan 1-1.2:1.8: cdc-wdm6: USB WDM device [ 633.594055] qmi_wwan 1-1.2:1.8 wwan0: register 'qmi_wwan' at usb-0000:00:1a.0-1.2, WWAN/QMI device, b6:f0:fe:96:37:0a [ 633.594758] qmi_wwan 1-1.2:1.10: cdc-wdm7: USB WDM device [ 633.595125] qmi_wwan 1-1.2:1.10 wwan1: register 'qmi_wwan' at usb-0000:00:1a.0-1.2, WWAN/QMI device, b6:f0:fe:96:37:0a [ 633.602695] qmi_wwan 1-1.2:1.10 ce2p1: renamed from wwan1 [ 633.629718] systemd-udevd[4892]: renamed network interface wwan1 to ce2p1 [ 633.629722] qmi_wwan 1-1.2:1.8 ce2p0: renamed from wwan0 [ 633.645594] systemd-udevd[4921]: renamed network interface wwan0 to ce2p0 [ 633.665439] usb 1-1.3: new low-speed USB device number 7 using ehci-pci [ 633.764774] usb 1-1.3: New USB device found, idVendor=0603, idProduct=00f2 [ 633.764789] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 633.764798] usb 1-1.3: Product: USB Keyboard [ 633.764803] usb 1-1.3: Manufacturer: NOVATEK [ 633.769568] input: NOVATEK USB Keyboard as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.0/0003:0603:00F2.0011/input/input18 [ 633.826514] hid-generic 0003:0603:00F2.0011: input,hidraw0: USB HID v1.10 Keyboard [NOVATEK USB Keyboard] on usb-0000:00:1a.0-1.3/input0 [ 633.833994] input: NOVATEK USB Keyboard as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.1/0003:0603:00F2.0012/input/input19 [ 633.890358] hid-generic 0003:0603:00F2.0012: input,hiddev0,hidraw1: USB HID v1.10 Device [NOVATEK USB Keyboard] on usb-0000:00:1a.0-1.3/input1 On Tue, Oct 20, 2015 at 8:08 PM, Peter Stuge <peter@xxxxxxxx> wrote: > Krzysztof Opasiak wrote: >>>>>>> There's still a bit of a race condition here, isn't there? >>>>>>> >>>>>>> Is there any good way to deal with that? >>> >>> Yes, there is a race condition. If the program closes the device node >>> before the device is plugged in again, the ttyUSB number won't change; >>> otherwise it will. No, there is no good way to deal with this. >> >> You may use device authorization. > > I think that's a good way. Thanks Krzysztof! > > > //Peter -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html