All of lore.kernel.org
 help / color / mirror / Atom feed
* 3.7.3, ttyUSB0 serial problem - devices stop working and only reboot helps (Inappropriate ioctl for device)
@ 2013-01-18 22:28 Arkadiusz Miskiewicz
  2013-01-19  0:47 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 7+ messages in thread
From: Arkadiusz Miskiewicz @ 2013-01-18 22:28 UTC (permalink / raw)
  To: linux-kernel, linux-usb
  Cc: Greg Kroah-Hartman, Johan Hovold, Peter Korsgaard, Alan Cox,
	Preston Fick

Hi.

Using 3.7.3 kernel and connecting two rs232 usb adapters, CP2102 and FT232RL, 
one after disconnecting another.

After few cycles of reconnecting and using socat (below) I'm getting problems 
accessing ttyUSB0:
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 
0x7fffb70c6ae0) = -1 ENOTTY (Inappropriate ioctl for device)

Unloading and reloading (by udev) modules ftdio_sio, cp210x, usbserial doesn't 
help. I have to reboot to get ttyUSB0 working (regardless of which driver, 
ftdio_sio or cp210x is handling ttyUSB0 - both stop working).

Any clues?

Device found:

[ 1215.692096] usb 6-2: new full-speed USB device number 16 using uhci_hcd
[ 1216.256286] usb 6-2: New USB device found, idVendor=0403, idProduct=6001
[ 1216.256300] usb 6-2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[ 1216.256308] usb 6-2: Product: FT232R USB UART
[ 1216.256315] usb 6-2: Manufacturer: FTDI
[ 1216.256322] usb 6-2: SerialNumber: A9W9TBMV
[ 1216.310445] ftdi_sio 6-2:1.0: FTDI USB Serial Device converter detected
[ 1216.310647] usb 6-2: Detected FT232RL
[ 1216.310656] usb 6-2: Number of endpoints 2
[ 1216.310665] usb 6-2: Endpoint 1 MaxPacketSize 64
[ 1216.310672] usb 6-2: Endpoint 2 MaxPacketSize 64
[ 1216.310679] usb 6-2: Setting MaxPacketSize 64
[ 1216.312449] usb 6-2: FTDI USB Serial Device converter now attached to 
ttyUSB0

and a problem with accessing ttyUSB0:

[root@t400 ~]# socat -ddd -s -u 
/dev/ttyUSB0,raw,echo=0,b115200,crnl,noctty,nonblock - | logger          
2013/01/18 23:14:25 socat[8095] E tcgetattr(3, 0x7fff09579470): Inappropriate 
ioctl for device
2013/01/18 23:14:25 socat[8095] E tcgetattr(3, 0x7fff095793e0): Inappropriate 
ioctl for device
2013/01/18 23:14:25 socat[8095] E tcgetattr(3, 0x7fff095795b0): Inappropriate 
ioctl for device

which is:

munmap(0x7faf81706000, 4096)            = 0
write(2, "2013/01/18 23:14:55 socat[8120] E tcgetattr(3, 0x7fffb70c6c40): 
Inappropriate ioctl for device\n", 952013/01/18 23:14:55 socat[8120] E 
tcgetattr(3, 0x7fffb70c6c40): Inappropriate ioctl for device
) = 95
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 
0x7fffb70c6a70) = -1 ENOTTY (Inappropriate ioctl for device)
write(2, "2013/01/18 23:14:55 socat[8120] E tcgetattr(3, 0x7fffb70c6bb0): 
Inappropriate ioctl for device\n", 952013/01/18 23:14:55 socat[8120] E 
tcgetattr(3, 0x7fffb70c6bb0): Inappropriate ioctl for device
) = 95
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 
0x7fffb70c6ae0) = -1 ENOTTY (Inappropriate ioctl for device)
write(2, "2013/01/18 23:14:55 socat[8120] E tcgetattr(3, 0x7fffb70c6d80): 
Inappropriate ioctl for device\n", 952013/01/18 23:14:55 socat[8120] E 
tcgetattr(3, 0x7fffb70c6d80): Inappropriate ioctl for device
) = 95
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 
0x7fffb70c6f50) = -1 ENOTTY (Inappropriate ioctl for device)
select(4, [3], [1], [], NULL)           = 2 (in [3], out [1])


kernel log:

[   59.985654] tun: Universal TUN/TAP device driver, 1.6
[   59.985658] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
[   60.010608] ip_tables: (C) 2000-2006 Netfilter Core Team
[   60.014958] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[  114.796110] usb 6-2: new full-speed USB device number 2 using uhci_hcd
[  115.360163] usb 6-2: New USB device found, idVendor=0403, idProduct=6001
[  115.360176] usb 6-2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[  115.360184] usb 6-2: Product: FT232R USB UART
[  115.360192] usb 6-2: Manufacturer: FTDI
[  115.360199] usb 6-2: SerialNumber: A9W9TBMV
[  115.423115] usbcore: registered new interface driver usbserial
[  115.423468] usbcore: registered new interface driver usbserial_generic
[  115.424272] usbserial: USB Serial support registered for generic
[  115.429982] usbcore: registered new interface driver ftdi_sio
[  115.430471] usbserial: USB Serial support registered for FTDI USB Serial 
Device
[  115.430970] ftdi_sio 6-2:1.0: FTDI USB Serial Device converter detected
[  115.431217] usb 6-2: Detected FT232RL
[  115.431226] usb 6-2: Number of endpoints 2
[  115.431234] usb 6-2: Endpoint 1 MaxPacketSize 64
[  115.431241] usb 6-2: Endpoint 2 MaxPacketSize 64
[  115.431249] usb 6-2: Setting MaxPacketSize 64
[  115.434351] usb 6-2: FTDI USB Serial Device converter now attached to 
ttyUSB0
[  122.664151] usb 6-2: USB disconnect, device number 2
[  122.665319] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now 
disconnected from ttyUSB0
[  122.665552] ftdi_sio 6-2:1.0: device disconnected
[  125.164067] usb 6-2: new full-speed USB device number 3 using uhci_hcd
[  125.328152] usb 6-2: New USB device found, idVendor=10c4, idProduct=ea60
[  125.328165] usb 6-2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[  125.328173] usb 6-2: Product: CP2102 USB to UART Bridge Controller
[  125.328181] usb 6-2: Manufacturer: Silicon Labs
[  125.328188] usb 6-2: SerialNumber: 0001
[  125.342690] usbcore: registered new interface driver cp210x
[  125.342846] usbserial: USB Serial support registered for cp210x
[  125.342970] cp210x 6-2:1.0: cp210x converter detected
[  125.452106] usb 6-2: reset full-speed USB device number 3 using uhci_hcd
[  125.600719] usb 6-2: cp210x converter now attached to ttyUSB0
[  158.376173] usb 6-2: USB disconnect, device number 3
[  158.377385] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[  158.377631] cp210x 6-2:1.0: device disconnected
[  160.996090] usb 6-2: new full-speed USB device number 4 using uhci_hcd
[  161.565156] usb 6-2: New USB device found, idVendor=0403, idProduct=6001
[  161.565170] usb 6-2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[  161.565179] usb 6-2: Product: FT232R USB UART
[  161.565186] usb 6-2: Manufacturer: FTDI
[  161.565193] usb 6-2: SerialNumber: A9W9TBMV
[  161.616326] ftdi_sio 6-2:1.0: FTDI USB Serial Device converter detected
[  161.616523] usb 6-2: Detected FT232RL
[  161.616533] usb 6-2: Number of endpoints 2
[  161.616541] usb 6-2: Endpoint 1 MaxPacketSize 64
[  161.616549] usb 6-2: Endpoint 2 MaxPacketSize 64
[  161.616556] usb 6-2: Setting MaxPacketSize 64
[  161.618363] usb 6-2: FTDI USB Serial Device converter now attached to 
ttyUSB0
[  172.264170] usb 6-2: USB disconnect, device number 4
[  172.265361] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now 
disconnected from ttyUSB0
[  172.265603] ftdi_sio 6-2:1.0: device disconnected
[  175.868109] usb 6-2: new full-speed USB device number 5 using uhci_hcd
[  176.032171] usb 6-2: New USB device found, idVendor=10c4, idProduct=ea60
[  176.032184] usb 6-2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[  176.032193] usb 6-2: Product: CP2102 USB to UART Bridge Controller
[  176.032200] usb 6-2: Manufacturer: Silicon Labs
[  176.032207] usb 6-2: SerialNumber: 0001
[  176.037429] cp210x 6-2:1.0: cp210x converter detected
[  176.148083] usb 6-2: reset full-speed USB device number 5 using uhci_hcd
[  176.296534] usb 6-2: cp210x converter now attached to ttyUSB0
[  179.208158] usb 6-2: USB disconnect, device number 5
[  179.209051] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[  179.209186] cp210x 6-2:1.0: device disconnected
[  181.432130] usb 6-2: new full-speed USB device number 6 using uhci_hcd
[  181.998176] usb 6-2: New USB device found, idVendor=0403, idProduct=6001
[  181.998189] usb 6-2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[  181.998198] usb 6-2: Product: FT232R USB UART
[  181.998205] usb 6-2: Manufacturer: FTDI
[  181.998212] usb 6-2: SerialNumber: A9W9TBMV
[  182.050340] ftdi_sio 6-2:1.0: FTDI USB Serial Device converter detected
[  182.050532] usb 6-2: Detected FT232RL
[  182.050542] usb 6-2: Number of endpoints 2
[  182.050550] usb 6-2: Endpoint 1 MaxPacketSize 64
[  182.050558] usb 6-2: Endpoint 2 MaxPacketSize 64
[  182.050565] usb 6-2: Setting MaxPacketSize 64
[  182.052353] usb 6-2: FTDI USB Serial Device converter now attached to 
ttyUSB0
[  190.368207] usb 6-2: USB disconnect, device number 6
[  190.368884] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now 
disconnected from ttyUSB0
[  190.369019] ftdi_sio 6-2:1.0: device disconnected
[  201.412081] usb 6-2: new full-speed USB device number 7 using uhci_hcd
[  201.928646] usb 6-2: New USB device found, idVendor=0403, idProduct=6001
[  201.928658] usb 6-2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[  201.928666] usb 6-2: Product: FT232R USB UART
[  201.928673] usb 6-2: Manufacturer: FTDI
[  201.928680] usb 6-2: SerialNumber: A9W9TBMV
[  201.975670] ftdi_sio 6-2:1.0: FTDI USB Serial Device converter detected
[  201.975954] usb 6-2: Detected FT232RL
[  201.975963] usb 6-2: Number of endpoints 2
[  201.975971] usb 6-2: Endpoint 1 MaxPacketSize 64
[  201.975979] usb 6-2: Endpoint 2 MaxPacketSize 64
[  201.975987] usb 6-2: Setting MaxPacketSize 64
[  201.978420] usb 6-2: FTDI USB Serial Device converter now attached to 
ttyUSB0
[  208.720121] usb 6-2: USB disconnect, device number 7
[  208.720744] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now 
disconnected from ttyUSB0
[  208.720914] ftdi_sio 6-2:1.0: device disconnected
[  212.752140] usb 6-2: new full-speed USB device number 8 using uhci_hcd
[  212.911539] usb 6-2: New USB device found, idVendor=10c4, idProduct=ea60
[  212.911550] usb 6-2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[  212.911559] usb 6-2: Product: CP2102 USB to UART Bridge Controller
[  212.911567] usb 6-2: Manufacturer: Silicon Labs
[  212.911574] usb 6-2: SerialNumber: 0001
[  212.916700] cp210x 6-2:1.0: cp210x converter detected
[  213.028104] usb 6-2: reset full-speed USB device number 8 using uhci_hcd
[  213.172172] usb 6-2: cp210x converter now attached to ttyUSB0
[  807.640161] usb 6-2: USB disconnect, device number 8
[  807.641334] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[  807.641577] cp210x 6-2:1.0: device disconnected
[  810.640093] usb 6-2: new full-speed USB device number 9 using uhci_hcd
[  811.208154] usb 6-2: New USB device found, idVendor=0403, idProduct=6001
[  811.208167] usb 6-2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[  811.208175] usb 6-2: Product: FT232R USB UART
[  811.208183] usb 6-2: Manufacturer: FTDI
[  811.208190] usb 6-2: SerialNumber: A9W9TBMV
[  811.259306] ftdi_sio 6-2:1.0: FTDI USB Serial Device converter detected
[  811.259507] usb 6-2: Detected FT232RL
[  811.259516] usb 6-2: Number of endpoints 2
[  811.259524] usb 6-2: Endpoint 1 MaxPacketSize 64
[  811.259532] usb 6-2: Endpoint 2 MaxPacketSize 64
[  811.259539] usb 6-2: Setting MaxPacketSize 64
[  811.262459] usb 6-2: FTDI USB Serial Device converter now attached to 
ttyUSB0
[  825.496159] usb 6-2: USB disconnect, device number 9
[  825.496836] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now 
disconnected from ttyUSB0
[  825.496998] ftdi_sio 6-2:1.0: device disconnected
[  828.344083] usb 6-2: new full-speed USB device number 10 using uhci_hcd
[  828.509148] usb 6-2: New USB device found, idVendor=10c4, idProduct=ea60
[  828.509162] usb 6-2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[  828.509170] usb 6-2: Product: CP2102 USB to UART Bridge Controller
[  828.509178] usb 6-2: Manufacturer: Silicon Labs
[  828.509185] usb 6-2: SerialNumber: 0001
[  828.514331] cp210x 6-2:1.0: cp210x converter detected
[  828.624117] usb 6-2: reset full-speed USB device number 10 using uhci_hcd
[  828.773481] usb 6-2: cp210x converter now attached to ttyUSB0
[  835.416141] usb 6-2: USB disconnect, device number 10
[  835.418207] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[  835.418419] cp210x 6-2:1.0: device disconnected
[  837.176104] usb 6-2: new full-speed USB device number 11 using uhci_hcd
[  837.742175] usb 6-2: New USB device found, idVendor=0403, idProduct=6001
[  837.742190] usb 6-2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[  837.742199] usb 6-2: Product: FT232R USB UART
[  837.742206] usb 6-2: Manufacturer: FTDI
[  837.742213] usb 6-2: SerialNumber: A9W9TBMV
[  837.794292] ftdi_sio 6-2:1.0: FTDI USB Serial Device converter detected
[  837.794483] usb 6-2: Detected FT232RL
[  837.794492] usb 6-2: Number of endpoints 2
[  837.794500] usb 6-2: Endpoint 1 MaxPacketSize 64
[  837.794508] usb 6-2: Endpoint 2 MaxPacketSize 64
[  837.794515] usb 6-2: Setting MaxPacketSize 64
[  837.796791] usb 6-2: FTDI USB Serial Device converter now attached to 
ttyUSB0
[  847.320187] usb 6-2: USB disconnect, device number 11
[  847.320837] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now 
disconnected from ttyUSB0
[  847.320997] ftdi_sio 6-2:1.0: device disconnected
[  848.880117] usb 6-2: new full-speed USB device number 12 using uhci_hcd
[  849.444245] usb 6-2: New USB device found, idVendor=0403, idProduct=6001
[  849.444251] usb 6-2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[  849.444254] usb 6-2: Product: FT232R USB UART
[  849.444257] usb 6-2: Manufacturer: FTDI
[  849.444259] usb 6-2: SerialNumber: A9W9TBMV
[  849.496469] ftdi_sio 6-2:1.0: FTDI USB Serial Device converter detected
[  849.496672] usb 6-2: Detected FT232RL
[  849.496681] usb 6-2: Number of endpoints 2
[  849.496689] usb 6-2: Endpoint 1 MaxPacketSize 64
[  849.496697] usb 6-2: Endpoint 2 MaxPacketSize 64
[  849.496704] usb 6-2: Setting MaxPacketSize 64
[  849.498442] usb 6-2: FTDI USB Serial Device converter now attached to 
ttyUSB0
[  858.650031] usbserial: USB Serial deregistering driver FTDI USB Serial 
Device
[  858.650574] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now 
disconnected from ttyUSB0
[  858.650724] usbcore: deregistering interface driver ftdi_sio
[  858.650915] ftdi_sio 6-2:1.0: device disconnected
[  861.952207] usb 6-2: USB disconnect, device number 12
[  864.480119] usb 6-2: new full-speed USB device number 13 using uhci_hcd
[  864.992179] usb 6-2: New USB device found, idVendor=0403, idProduct=6001
[  864.992192] usb 6-2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[  864.992201] usb 6-2: Product: FT232R USB UART
[  864.992208] usb 6-2: Manufacturer: FTDI
[  864.992215] usb 6-2: SerialNumber: A9W9TBMV
[  865.050749] usbcore: registered new interface driver ftdi_sio
[  865.050913] usbserial: USB Serial support registered for FTDI USB Serial 
Device
[  865.051415] ftdi_sio 6-2:1.0: FTDI USB Serial Device converter detected
[  865.051594] usb 6-2: Detected FT232RL
[  865.051603] usb 6-2: Number of endpoints 2
[  865.051611] usb 6-2: Endpoint 1 MaxPacketSize 64
[  865.051619] usb 6-2: Endpoint 2 MaxPacketSize 64
[  865.051626] usb 6-2: Setting MaxPacketSize 64
[  865.053280] usb 6-2: FTDI USB Serial Device converter now attached to 
ttyUSB0
[  876.468944] usbserial: USB Serial deregistering driver cp210x
[  876.469128] usbcore: deregistering interface driver cp210x
[  879.139616] usbserial: USB Serial deregistering driver FTDI USB Serial 
Device
[  879.141600] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now 
disconnected from ttyUSB0
[  879.141780] usbcore: deregistering interface driver ftdi_sio
[  879.141962] ftdi_sio 6-2:1.0: device disconnected
[  884.024151] usb 6-2: USB disconnect, device number 13
[  898.164094] usb 6-2: new full-speed USB device number 14 using uhci_hcd
[  898.728171] usb 6-2: New USB device found, idVendor=0403, idProduct=6001
[  898.728184] usb 6-2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[  898.728193] usb 6-2: Product: FT232R USB UART
[  898.728200] usb 6-2: Manufacturer: FTDI
[  898.728207] usb 6-2: SerialNumber: A9W9TBMV
[  898.786148] usbcore: registered new interface driver ftdi_sio
[  898.786296] usbserial: USB Serial support registered for FTDI USB Serial 
Device
[  898.786801] ftdi_sio 6-2:1.0: FTDI USB Serial Device converter detected
[  898.786968] usb 6-2: Detected FT232RL
[  898.786977] usb 6-2: Number of endpoints 2
[  898.786985] usb 6-2: Endpoint 1 MaxPacketSize 64
[  898.786993] usb 6-2: Endpoint 2 MaxPacketSize 64
[  898.787000] usb 6-2: Setting MaxPacketSize 64
[  898.789573] usb 6-2: FTDI USB Serial Device converter now attached to 
ttyUSB0
[  949.517371] usbserial: USB Serial deregistering driver FTDI USB Serial 
Device
[  949.518070] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now 
disconnected from ttyUSB0
[  949.518210] usbcore: deregistering interface driver ftdi_sio
[  949.519399] ftdi_sio 6-2:1.0: device disconnected
[  959.888070] usbserial: USB Serial deregistering driver generic
[  959.888316] usbcore: deregistering interface driver usbserial_generic
[  959.888464] usbcore: deregistering interface driver usbserial
[  966.360200] usb 6-2: USB disconnect, device number 14
[  971.064099] usb 6-2: new full-speed USB device number 15 using uhci_hcd
[  971.629155] usb 6-2: New USB device found, idVendor=0403, idProduct=6001
[  971.629169] usb 6-2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[  971.629178] usb 6-2: Product: FT232R USB UART
[  971.629185] usb 6-2: Manufacturer: FTDI
[  971.629192] usb 6-2: SerialNumber: A9W9TBMV
[  971.686522] usbcore: registered new interface driver usbserial
[  971.686708] usbcore: registered new interface driver usbserial_generic
[  971.686890] usbserial: USB Serial support registered for generic
[  971.687838] usbcore: registered new interface driver ftdi_sio
[  971.688273] usbserial: USB Serial support registered for FTDI USB Serial 
Device
[  971.688433] ftdi_sio 6-2:1.0: FTDI USB Serial Device converter detected
[  971.688514] usb 6-2: Detected FT232RL
[  971.688517] usb 6-2: Number of endpoints 2
[  971.688519] usb 6-2: Endpoint 1 MaxPacketSize 64
[  971.688522] usb 6-2: Endpoint 2 MaxPacketSize 64
[  971.688524] usb 6-2: Setting MaxPacketSize 64
[  971.690186] usb 6-2: FTDI USB Serial Device converter now attached to 
ttyUSB0
[ 1214.112160] usb 6-2: USB disconnect, device number 15
[ 1214.112786] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now 
disconnected from ttyUSB0
[ 1214.112957] ftdi_sio 6-2:1.0: device disconnected
[ 1215.692096] usb 6-2: new full-speed USB device number 16 using uhci_hcd
[ 1216.256286] usb 6-2: New USB device found, idVendor=0403, idProduct=6001
[ 1216.256300] usb 6-2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[ 1216.256308] usb 6-2: Product: FT232R USB UART
[ 1216.256315] usb 6-2: Manufacturer: FTDI
[ 1216.256322] usb 6-2: SerialNumber: A9W9TBMV
[ 1216.310445] ftdi_sio 6-2:1.0: FTDI USB Serial Device converter detected
[ 1216.310647] usb 6-2: Detected FT232RL
[ 1216.310656] usb 6-2: Number of endpoints 2
[ 1216.310665] usb 6-2: Endpoint 1 MaxPacketSize 64
[ 1216.310672] usb 6-2: Endpoint 2 MaxPacketSize 64
[ 1216.310679] usb 6-2: Setting MaxPacketSize 64
[ 1216.312449] usb 6-2: FTDI USB Serial Device converter now attached to 
ttyUSB0


-- 
Arkadiusz Miśkiewicz, arekm / maven.pl

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 3.7.3, ttyUSB0 serial problem - devices stop working and only reboot helps (Inappropriate ioctl for device)
  2013-01-18 22:28 3.7.3, ttyUSB0 serial problem - devices stop working and only reboot helps (Inappropriate ioctl for device) Arkadiusz Miskiewicz
@ 2013-01-19  0:47 ` Greg Kroah-Hartman
  2013-01-19  8:18   ` Arkadiusz Miskiewicz
  0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2013-01-19  0:47 UTC (permalink / raw)
  To: Arkadiusz Miskiewicz
  Cc: linux-kernel, linux-usb, Johan Hovold, Peter Korsgaard, Alan Cox,
	Preston Fick

On Fri, Jan 18, 2013 at 11:28:43PM +0100, Arkadiusz Miskiewicz wrote:
> Hi.
> 
> Using 3.7.3 kernel and connecting two rs232 usb adapters, CP2102 and FT232RL, 
> one after disconnecting another.
> 
> After few cycles of reconnecting and using socat (below) I'm getting problems 
> accessing ttyUSB0:
> ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 
> 0x7fffb70c6ae0) = -1 ENOTTY (Inappropriate ioctl for device)
> 
> Unloading and reloading (by udev) modules ftdio_sio, cp210x, usbserial doesn't 
> help. I have to reboot to get ttyUSB0 working (regardless of which driver, 
> ftdio_sio or cp210x is handling ttyUSB0 - both stop working).
> 
> Any clues?

The kernel log shows the device getting removed a bunch and then coming
back, which implies electrical issues (flaky connection, low power,
etc.)  Are you really removing it and plugging it back in?  Or is it
doing it all by itself?

Can you try better cables?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 3.7.3, ttyUSB0 serial problem - devices stop working and only reboot helps (Inappropriate ioctl for device)
  2013-01-19  0:47 ` Greg Kroah-Hartman
@ 2013-01-19  8:18   ` Arkadiusz Miskiewicz
  2013-01-19  8:48     ` Arkadiusz Miskiewicz
  0 siblings, 1 reply; 7+ messages in thread
From: Arkadiusz Miskiewicz @ 2013-01-19  8:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, linux-usb, Johan Hovold, Peter Korsgaard, Alan Cox,
	Preston Fick

On Saturday 19 of January 2013, Greg Kroah-Hartman wrote:
> On Fri, Jan 18, 2013 at 11:28:43PM +0100, Arkadiusz Miskiewicz wrote:
> > Hi.
> > 
> > Using 3.7.3 kernel and connecting two rs232 usb adapters, CP2102 and
> > FT232RL, one after disconnecting another.
> > 
> > After few cycles of reconnecting and using socat (below) I'm getting
> > problems accessing ttyUSB0:
> > ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS,
> > 0x7fffb70c6ae0) = -1 ENOTTY (Inappropriate ioctl for device)
> > 
> > Unloading and reloading (by udev) modules ftdio_sio, cp210x, usbserial
> > doesn't help. I have to reboot to get ttyUSB0 working (regardless of
> > which driver, ftdio_sio or cp210x is handling ttyUSB0 - both stop
> > working).
> > 
> > Any clues?
> 
> The kernel log shows the device getting removed a bunch and then coming
> back, which implies electrical issues (flaky connection, low power,
> etc.)  Are you really removing it and plugging it back in?  Or is it
> doing it all by itself?

I was doing plug in CP2102, remove it, plug in FT232RL after few seconds, 
remove it, plug in CP... (and various variations, several times) and testing 
with socat before removing devices. After some iteration the problem appears 
and only reboot helps.




Reproducible. suspend to ram/resume cycle didn't change anything, device still 
has a problem, even after reconnection of device.

> 
> thanks,
> 
> greg k-h


-- 
Arkadiusz Miśkiewicz, arekm / maven.pl

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 3.7.3, ttyUSB0 serial problem - devices stop working and only reboot helps (Inappropriate ioctl for device)
  2013-01-19  8:18   ` Arkadiusz Miskiewicz
@ 2013-01-19  8:48     ` Arkadiusz Miskiewicz
  2013-01-20  2:19       ` Woody Suwalski
  0 siblings, 1 reply; 7+ messages in thread
From: Arkadiusz Miskiewicz @ 2013-01-19  8:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, linux-usb, Johan Hovold, Peter Korsgaard, Alan Cox,
	Preston Fick

On Saturday 19 of January 2013, Arkadiusz Miskiewicz wrote:
> On Saturday 19 of January 2013, Greg Kroah-Hartman wrote:
> > On Fri, Jan 18, 2013 at 11:28:43PM +0100, Arkadiusz Miskiewicz wrote:
> > > Hi.
> > > 
> > > Using 3.7.3 kernel and connecting two rs232 usb adapters, CP2102 and
> > > FT232RL, one after disconnecting another.
> > > 
> > > After few cycles of reconnecting and using socat (below) I'm getting
> > > problems accessing ttyUSB0:
> > > ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
> > > TCGETS, 0x7fffb70c6ae0) = -1 ENOTTY (Inappropriate ioctl for device)
> > > 
> > > Unloading and reloading (by udev) modules ftdio_sio, cp210x, usbserial
> > > doesn't help. I have to reboot to get ttyUSB0 working (regardless of
> > > which driver, ftdio_sio or cp210x is handling ttyUSB0 - both stop
> > > working).
> > > 
> > > Any clues?
> > 
> > The kernel log shows the device getting removed a bunch and then coming
> > back, which implies electrical issues (flaky connection, low power,
> > etc.)  Are you really removing it and plugging it back in?  Or is it
> > doing it all by itself?
> 
> I was doing plug in CP2102, remove it, plug in FT232RL after few seconds,
> remove it, plug in CP... (and various variations, several times) and
> testing with socat before removing devices. After some iteration the
> problem appears and only reboot helps.

The issue is really weird. Machine is Thinkpad T400 2764CTO (latest bios). 
When the problem happened on 3.7.3 today I rebooted into 3.8rc4 and ... 
freshly after reboot and plugging in PL2303 adapter the problem was already 
there. Didn't have to do unplug/plug cycle to make it happen.

Looks like sometimes reboot cures the problem, sometimes it doesn't. Now 
powered off laptop and powered it on - problem gone.

Connected PL2303, ran socat, disconnected PL2303 (while socat was running) -> 
problem happened again. Looks like it doesn't depend on adapter chip type.

So to reproduce here:
- boot fresh 3.8rc4
- plug in some adapter (PL2303 for example)
- run "socat -ddd -s -u /dev/ttyUSB0,raw,echo=0,b115200,crnl,noctty,nonblock - 
| logger" - it should run fine, without any error
- disconnect adapter; socat should exit with error "W cannot restore terminal 
settings on fd 3: Input/output error"
- plug in adapter again
- run socat again -> this time error "E tcgetattr(3, 0x7fff21411780): 
Inappropriate ioctl for device" immediately always; regardless which adapter 
is used and if kernel module drivers for these adapters were reloaded

dmesg:
http://pastebin.com/r1Q5mmgt

config:
http://pastebin.com/8dpFFzuU

lspci:
http://pastebin.com/TBtUg1tW

lsusb:
http://pastebin.com/SueVw9CD

[   53.776047] usb 4-1: new full-speed USB device number 2 using uhci_hcd
[   53.938053] usb 4-1: New USB device found, idVendor=067b, idProduct=2303
[   53.938060] usb 4-1: New USB device strings: Mfr=1, Product=2, 
SerialNumber=0
[   53.938065] usb 4-1: Product: USB-Serial Controller
[   53.938068] usb 4-1: Manufacturer: Prolific Technology Inc.
[   53.949924] usbcore: registered new interface driver usbserial
[   53.950364] usbcore: registered new interface driver usbserial_generic
[   53.951147] usbserial: USB Serial support registered for generic
[   53.954268] usbcore: registered new interface driver pl2303
[   53.955009] usbserial: USB Serial support registered for pl2303
[   53.955039] pl2303 4-1:1.0: pl2303 converter detected
[   53.967394] usb 4-1: pl2303 converter now attached to ttyUSB0
[   64.492122] usb 4-1: USB disconnect, device number 2
[   64.501748] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
[   64.502343] pl2303 4-1:1.0: device disconnected
[   66.494930] usb 4-1: new full-speed USB device number 3 using uhci_hcd
[   66.654247] usb 4-1: New USB device found, idVendor=067b, idProduct=2303
[   66.654261] usb 4-1: New USB device strings: Mfr=1, Product=2, 
SerialNumber=0
[   66.654269] usb 4-1: Product: USB-Serial Controller
[   66.654276] usb 4-1: Manufacturer: Prolific Technology Inc.
[   66.659661] pl2303 4-1:1.0: pl2303 converter detected
[   66.671587] usb 4-1: pl2303 converter now attached to ttyUSB0

5722  munmap(0x7f1bfc0d7000, 4096)      = 0
5722  write(2, "2013/01/19 09:36:38 socat[5722] E tcgetattr(3, 
0x7fffeff64020): Inappropriate ioctl for device\n", 95) = 95
5722  ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 
0x7fffeff63e50) = -1 ENOTTY (Inappropriate ioctl for device)
5722  write(2, "2013/01/19 09:36:38 socat[5722] E tcgetattr(3, 
0x7fffeff63f90): Inappropriate ioctl for device\n", 95) = 95
5722  ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 
0x7fffeff63ec0) = -1 ENOTTY (Inappropriate ioctl for device)
5722  write(2, "2013/01/19 09:36:38 socat[5722] E tcgetattr(3, 
0x7fffeff64160): Inappropriate ioctl for device\n", 95) = 95
5722  fcntl(3, F_SETFD, FD_CLOEXEC)     = 0
5722  ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 
0x7fffeff64330) = -1 ENOTTY (Inappropriate ioctl for device)
5722  select(4, [3], [1], [], NULL)     = 2 (in [3], out [1])

-- 
Arkadiusz Miśkiewicz, arekm / maven.pl

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 3.7.3, ttyUSB0 serial problem - devices stop working and only reboot helps (Inappropriate ioctl for device)
  2013-01-19  8:48     ` Arkadiusz Miskiewicz
@ 2013-01-20  2:19       ` Woody Suwalski
  2013-01-20  9:04         ` Arkadiusz Miskiewicz
  0 siblings, 1 reply; 7+ messages in thread
From: Woody Suwalski @ 2013-01-20  2:19 UTC (permalink / raw)
  To: Arkadiusz Miskiewicz
  Cc: Greg Kroah-Hartman, linux-kernel, linux-usb, Johan Hovold,
	Peter Korsgaard, Alan Cox, Preston Fick

Arkadiusz Miskiewicz wrote:
> On Saturday 19 of January 2013, Arkadiusz Miskiewicz wrote:
>> On Saturday 19 of January 2013, Greg Kroah-Hartman wrote:
>>> On Fri, Jan 18, 2013 at 11:28:43PM +0100, Arkadiusz Miskiewicz wrote:
>>>> Hi.
>>>>
>>>> Using 3.7.3 kernel and connecting two rs232 usb adapters, CP2102 and
>>>> FT232RL, one after disconnecting another.
>>>>
>>>> After few cycles of reconnecting and using socat (below) I'm getting
>>>> problems accessing ttyUSB0:
>>>> ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
>>>> TCGETS, 0x7fffb70c6ae0) = -1 ENOTTY (Inappropriate ioctl for device)
>>>>
>>>> Unloading and reloading (by udev) modules ftdio_sio, cp210x, usbserial
>>>> doesn't help. I have to reboot to get ttyUSB0 working (regardless of
>>>> which driver, ftdio_sio or cp210x is handling ttyUSB0 - both stop
>>>> working).
>>>>
>>>> Any clues?
>>> The kernel log shows the device getting removed a bunch and then coming
>>> back, which implies electrical issues (flaky connection, low power,
>>> etc.)  Are you really removing it and plugging it back in?  Or is it
>>> doing it all by itself?
>> I was doing plug in CP2102, remove it, plug in FT232RL after few seconds,
>> remove it, plug in CP... (and various variations, several times) and
>> testing with socat before removing devices. After some iteration the
>> problem appears and only reboot helps.
> The issue is really weird. Machine is Thinkpad T400 2764CTO (latest bios).
> When the problem happened on 3.7.3 today I rebooted into 3.8rc4 and ...
> freshly after reboot and plugging in PL2303 adapter the problem was already
> there. Didn't have to do unplug/plug cycle to make it happen.
>
> Looks like sometimes reboot cures the problem, sometimes it doesn't. Now
> powered off laptop and powered it on - problem gone.
>
> Connected PL2303, ran socat, disconnected PL2303 (while socat was running) ->
> problem happened again. Looks like it doesn't depend on adapter chip type.
>
> So to reproduce here:
> - boot fresh 3.8rc4
> - plug in some adapter (PL2303 for example)
> - run "socat -ddd -s -u /dev/ttyUSB0,raw,echo=0,b115200,crnl,noctty,nonblock -
> | logger" - it should run fine, without any error
> - disconnect adapter; socat should exit with error "W cannot restore terminal
> settings on fd 3: Input/output error"
> - plug in adapter again
> - run socat again -> this time error "E tcgetattr(3, 0x7fff21411780):
> Inappropriate ioctl for device" immediately always; regardless which adapter
> is used and if kernel module drivers for these adapters were reloaded
>
> dmesg:
> http://pastebin.com/r1Q5mmgt
>
> config:
> http://pastebin.com/8dpFFzuU
>
> lspci:
> http://pastebin.com/TBtUg1tW
>
> lsusb:
> http://pastebin.com/SueVw9CD
>
> [   53.776047] usb 4-1: new full-speed USB device number 2 using uhci_hcd
> [   53.938053] usb 4-1: New USB device found, idVendor=067b, idProduct=2303
> [   53.938060] usb 4-1: New USB device strings: Mfr=1, Product=2,
> SerialNumber=0
> [   53.938065] usb 4-1: Product: USB-Serial Controller
> [   53.938068] usb 4-1: Manufacturer: Prolific Technology Inc.
> [   53.949924] usbcore: registered new interface driver usbserial
> [   53.950364] usbcore: registered new interface driver usbserial_generic
> [   53.951147] usbserial: USB Serial support registered for generic
> [   53.954268] usbcore: registered new interface driver pl2303
> [   53.955009] usbserial: USB Serial support registered for pl2303
> [   53.955039] pl2303 4-1:1.0: pl2303 converter detected
> [   53.967394] usb 4-1: pl2303 converter now attached to ttyUSB0
> [   64.492122] usb 4-1: USB disconnect, device number 2
> [   64.501748] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
> [   64.502343] pl2303 4-1:1.0: device disconnected
> [   66.494930] usb 4-1: new full-speed USB device number 3 using uhci_hcd
> [   66.654247] usb 4-1: New USB device found, idVendor=067b, idProduct=2303
> [   66.654261] usb 4-1: New USB device strings: Mfr=1, Product=2,
> SerialNumber=0
> [   66.654269] usb 4-1: Product: USB-Serial Controller
> [   66.654276] usb 4-1: Manufacturer: Prolific Technology Inc.
> [   66.659661] pl2303 4-1:1.0: pl2303 converter detected
> [   66.671587] usb 4-1: pl2303 converter now attached to ttyUSB0
>
> 5722  munmap(0x7f1bfc0d7000, 4096)      = 0
> 5722  write(2, "2013/01/19 09:36:38 socat[5722] E tcgetattr(3,
> 0x7fffeff64020): Inappropriate ioctl for device\n", 95) = 95
> 5722  ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS,
> 0x7fffeff63e50) = -1 ENOTTY (Inappropriate ioctl for device)
> 5722  write(2, "2013/01/19 09:36:38 socat[5722] E tcgetattr(3,
> 0x7fffeff63f90): Inappropriate ioctl for device\n", 95) = 95
> 5722  ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS,
> 0x7fffeff63ec0) = -1 ENOTTY (Inappropriate ioctl for device)
> 5722  write(2, "2013/01/19 09:36:38 socat[5722] E tcgetattr(3,
> 0x7fffeff64160): Inappropriate ioctl for device\n", 95) = 95
> 5722  fcntl(3, F_SETFD, FD_CLOEXEC)     = 0
> 5722  ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS,
> 0x7fffeff64330) = -1 ENOTTY (Inappropriate ioctl for device)
> 5722  select(4, [3], [1], [], NULL)     = 2 (in [3], out [1])
>
If I unplug the USB device while tty session is running, I will get on 
next plugin a new devnode ttyUSB1. It seems that you are trying to reuse 
an old "dead" connection? Could it be rather a udev problem?

Woody


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 3.7.3, ttyUSB0 serial problem - devices stop working and only reboot helps (Inappropriate ioctl for device)
  2013-01-20  2:19       ` Woody Suwalski
@ 2013-01-20  9:04         ` Arkadiusz Miskiewicz
  2013-01-20 12:26           ` Arkadiusz Miskiewicz
  0 siblings, 1 reply; 7+ messages in thread
From: Arkadiusz Miskiewicz @ 2013-01-20  9:04 UTC (permalink / raw)
  To: Woody Suwalski
  Cc: Greg Kroah-Hartman, linux-kernel, linux-usb, Johan Hovold,
	Peter Korsgaard, Alan Cox, Preston Fick

On Sunday 20 of January 2013, Woody Suwalski wrote:
> Arkadiusz Miskiewicz wrote:
> > On Saturday 19 of January 2013, Arkadiusz Miskiewicz wrote:
> >> On Saturday 19 of January 2013, Greg Kroah-Hartman wrote:
> >>> On Fri, Jan 18, 2013 at 11:28:43PM +0100, Arkadiusz Miskiewicz wrote:
> >>>> Hi.
> >>>> 
> >>>> Using 3.7.3 kernel and connecting two rs232 usb adapters, CP2102 and
> >>>> FT232RL, one after disconnecting another.
> >>>> 
> >>>> After few cycles of reconnecting and using socat (below) I'm getting
> >>>> problems accessing ttyUSB0:
> >>>> ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
> >>>> TCGETS, 0x7fffb70c6ae0) = -1 ENOTTY (Inappropriate ioctl for device)
> >>>> 
> >>>> Unloading and reloading (by udev) modules ftdio_sio, cp210x, usbserial
> >>>> doesn't help. I have to reboot to get ttyUSB0 working (regardless of
> >>>> which driver, ftdio_sio or cp210x is handling ttyUSB0 - both stop
> >>>> working).
> >>>> 
> >>>> Any clues?
> >>> 
> >>> The kernel log shows the device getting removed a bunch and then coming
> >>> back, which implies electrical issues (flaky connection, low power,
> >>> etc.)  Are you really removing it and plugging it back in?  Or is it
> >>> doing it all by itself?
> >> 
> >> I was doing plug in CP2102, remove it, plug in FT232RL after few
> >> seconds, remove it, plug in CP... (and various variations, several
> >> times) and testing with socat before removing devices. After some
> >> iteration the problem appears and only reboot helps.
> > 
> > The issue is really weird. Machine is Thinkpad T400 2764CTO (latest
> > bios). When the problem happened on 3.7.3 today I rebooted into 3.8rc4
> > and ... freshly after reboot and plugging in PL2303 adapter the problem
> > was already there. Didn't have to do unplug/plug cycle to make it
> > happen.
> > 
> > Looks like sometimes reboot cures the problem, sometimes it doesn't. Now
> > powered off laptop and powered it on - problem gone.
> > 
> > Connected PL2303, ran socat, disconnected PL2303 (while socat was
> > running) -> problem happened again. Looks like it doesn't depend on
> > adapter chip type.
> > 
> > So to reproduce here:
> > - boot fresh 3.8rc4
> > - plug in some adapter (PL2303 for example)
> > - run "socat -ddd -s -u
> > /dev/ttyUSB0,raw,echo=0,b115200,crnl,noctty,nonblock -
> > 
> > | logger" - it should run fine, without any error
> > 
> > - disconnect adapter; socat should exit with error "W cannot restore
> > terminal settings on fd 3: Input/output error"
> > - plug in adapter again
> > - run socat again -> this time error "E tcgetattr(3, 0x7fff21411780):
> > Inappropriate ioctl for device" immediately always; regardless which
> > adapter is used and if kernel module drivers for these adapters were
> > reloaded
> > 
> > dmesg:
> > http://pastebin.com/r1Q5mmgt
> > 
> > config:
> > http://pastebin.com/8dpFFzuU
> > 
> > lspci:
> > http://pastebin.com/TBtUg1tW
> > 
> > lsusb:
> > http://pastebin.com/SueVw9CD
> > 
> > [   53.776047] usb 4-1: new full-speed USB device number 2 using uhci_hcd
> > [   53.938053] usb 4-1: New USB device found, idVendor=067b,
> > idProduct=2303 [   53.938060] usb 4-1: New USB device strings: Mfr=1,
> > Product=2, SerialNumber=0
> > [   53.938065] usb 4-1: Product: USB-Serial Controller
> > [   53.938068] usb 4-1: Manufacturer: Prolific Technology Inc.
> > [   53.949924] usbcore: registered new interface driver usbserial
> > [   53.950364] usbcore: registered new interface driver usbserial_generic
> > [   53.951147] usbserial: USB Serial support registered for generic
> > [   53.954268] usbcore: registered new interface driver pl2303
> > [   53.955009] usbserial: USB Serial support registered for pl2303
> > [   53.955039] pl2303 4-1:1.0: pl2303 converter detected
> > [   53.967394] usb 4-1: pl2303 converter now attached to ttyUSB0
> > [   64.492122] usb 4-1: USB disconnect, device number 2
> > [   64.501748] pl2303 ttyUSB0: pl2303 converter now disconnected from
> > ttyUSB0 [   64.502343] pl2303 4-1:1.0: device disconnected
> > [   66.494930] usb 4-1: new full-speed USB device number 3 using uhci_hcd
> > [   66.654247] usb 4-1: New USB device found, idVendor=067b,
> > idProduct=2303 [   66.654261] usb 4-1: New USB device strings: Mfr=1,
> > Product=2, SerialNumber=0
> > [   66.654269] usb 4-1: Product: USB-Serial Controller
> > [   66.654276] usb 4-1: Manufacturer: Prolific Technology Inc.
> > [   66.659661] pl2303 4-1:1.0: pl2303 converter detected
> > [   66.671587] usb 4-1: pl2303 converter now attached to ttyUSB0
> > 
> > 5722  munmap(0x7f1bfc0d7000, 4096)      = 0
> > 5722  write(2, "2013/01/19 09:36:38 socat[5722] E tcgetattr(3,
> > 0x7fffeff64020): Inappropriate ioctl for device\n", 95) = 95
> > 5722  ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
> > TCGETS, 0x7fffeff63e50) = -1 ENOTTY (Inappropriate ioctl for device)
> > 5722  write(2, "2013/01/19 09:36:38 socat[5722] E tcgetattr(3,
> > 0x7fffeff63f90): Inappropriate ioctl for device\n", 95) = 95
> > 5722  ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
> > TCGETS, 0x7fffeff63ec0) = -1 ENOTTY (Inappropriate ioctl for device)
> > 5722  write(2, "2013/01/19 09:36:38 socat[5722] E tcgetattr(3,
> > 0x7fffeff64160): Inappropriate ioctl for device\n", 95) = 95
> > 5722  fcntl(3, F_SETFD, FD_CLOEXEC)     = 0
> > 5722  ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
> > TCGETS, 0x7fffeff64330) = -1 ENOTTY (Inappropriate ioctl for device)
> > 5722  select(4, [3], [1], [], NULL)     = 2 (in [3], out [1])
> 
> If I unplug the USB device while tty session is running, I will get on
> next plugin a new devnode ttyUSB1. It seems that you are trying to reuse
> an old "dead" connection? Could it be rather a udev problem?

After plugging back in kernel says ttyUSB0 in dmesg ("usb 4-1: pl2303 
converter now attached to ttyUSB0"), not ttyUSB1, so it's not udev problem.

Also socat exits with error after unplugging (""W cannot restore
terminal settings on fd 3: Input/output error"") releasing ttyUSB0, so next 
plug in should still use ttyUSB0.

Tried to reproduce the same problem on my PC and failed. On Thinkpad T400 I'm 
reproducing without any problem.

> Woody

-- 
Arkadiusz Miśkiewicz, arekm / maven.pl

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 3.7.3, ttyUSB0 serial problem - devices stop working and only reboot helps (Inappropriate ioctl for device)
  2013-01-20  9:04         ` Arkadiusz Miskiewicz
@ 2013-01-20 12:26           ` Arkadiusz Miskiewicz
  0 siblings, 0 replies; 7+ messages in thread
From: Arkadiusz Miskiewicz @ 2013-01-20 12:26 UTC (permalink / raw)
  To: Woody Suwalski
  Cc: Greg Kroah-Hartman, linux-kernel, linux-usb, Johan Hovold,
	Peter Korsgaard, Alan Cox, Preston Fick

On Sunday 20 of January 2013, Arkadiusz Miskiewicz wrote:
> On Sunday 20 of January 2013, Woody Suwalski wrote:
> > Arkadiusz Miskiewicz wrote:
> > > On Saturday 19 of January 2013, Arkadiusz Miskiewicz wrote:
> > >> On Saturday 19 of January 2013, Greg Kroah-Hartman wrote:
> > >>> On Fri, Jan 18, 2013 at 11:28:43PM +0100, Arkadiusz Miskiewicz wrote:
> > >>>> Hi.
> > >>>> 
> > >>>> Using 3.7.3 kernel and connecting two rs232 usb adapters, CP2102 and
> > >>>> FT232RL, one after disconnecting another.
> > >>>> 
> > >>>> After few cycles of reconnecting and using socat (below) I'm getting
> > >>>> problems accessing ttyUSB0:
> > >>>> ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
> > >>>> TCGETS, 0x7fffb70c6ae0) = -1 ENOTTY (Inappropriate ioctl for device)
> > >>>> 
> > >>>> Unloading and reloading (by udev) modules ftdio_sio, cp210x,
> > >>>> usbserial doesn't help. I have to reboot to get ttyUSB0 working
> > >>>> (regardless of which driver, ftdio_sio or cp210x is handling
> > >>>> ttyUSB0 - both stop working).
> > >>>> 
> > >>>> Any clues?
> > >>> 
> > >>> The kernel log shows the device getting removed a bunch and then
> > >>> coming back, which implies electrical issues (flaky connection, low
> > >>> power, etc.)  Are you really removing it and plugging it back in? 
> > >>> Or is it doing it all by itself?
> > >> 
> > >> I was doing plug in CP2102, remove it, plug in FT232RL after few
> > >> seconds, remove it, plug in CP... (and various variations, several
> > >> times) and testing with socat before removing devices. After some
> > >> iteration the problem appears and only reboot helps.
> > > 
> > > The issue is really weird. Machine is Thinkpad T400 2764CTO (latest
> > > bios). When the problem happened on 3.7.3 today I rebooted into 3.8rc4
> > > and ... freshly after reboot and plugging in PL2303 adapter the problem
> > > was already there. Didn't have to do unplug/plug cycle to make it
> > > happen.
> > > 
> > > Looks like sometimes reboot cures the problem, sometimes it doesn't.
> > > Now powered off laptop and powered it on - problem gone.
> > > 
> > > Connected PL2303, ran socat, disconnected PL2303 (while socat was
> > > running) -> problem happened again. Looks like it doesn't depend on
> > > adapter chip type.
> > > 
> > > So to reproduce here:
> > > - boot fresh 3.8rc4
> > > - plug in some adapter (PL2303 for example)
> > > - run "socat -ddd -s -u
> > > /dev/ttyUSB0,raw,echo=0,b115200,crnl,noctty,nonblock -
> > > 
> > > | logger" - it should run fine, without any error
> > > 
> > > - disconnect adapter; socat should exit with error "W cannot restore
> > > terminal settings on fd 3: Input/output error"
> > > - plug in adapter again
> > > - run socat again -> this time error "E tcgetattr(3, 0x7fff21411780):
> > > Inappropriate ioctl for device" immediately always; regardless which
> > > adapter is used and if kernel module drivers for these adapters were
> > > reloaded
> > > 
> > > dmesg:
> > > http://pastebin.com/r1Q5mmgt
> > > 
> > > config:
> > > http://pastebin.com/8dpFFzuU
> > > 
> > > lspci:
> > > http://pastebin.com/TBtUg1tW
> > > 
> > > lsusb:
> > > http://pastebin.com/SueVw9CD
> > > 
> > > [   53.776047] usb 4-1: new full-speed USB device number 2 using
> > > uhci_hcd [   53.938053] usb 4-1: New USB device found, idVendor=067b,
> > > idProduct=2303 [   53.938060] usb 4-1: New USB device strings: Mfr=1,
> > > Product=2, SerialNumber=0
> > > [   53.938065] usb 4-1: Product: USB-Serial Controller
> > > [   53.938068] usb 4-1: Manufacturer: Prolific Technology Inc.
> > > [   53.949924] usbcore: registered new interface driver usbserial
> > > [   53.950364] usbcore: registered new interface driver
> > > usbserial_generic [   53.951147] usbserial: USB Serial support
> > > registered for generic [   53.954268] usbcore: registered new
> > > interface driver pl2303 [   53.955009] usbserial: USB Serial support
> > > registered for pl2303 [   53.955039] pl2303 4-1:1.0: pl2303 converter
> > > detected
> > > [   53.967394] usb 4-1: pl2303 converter now attached to ttyUSB0
> > > [   64.492122] usb 4-1: USB disconnect, device number 2
> > > [   64.501748] pl2303 ttyUSB0: pl2303 converter now disconnected from
> > > ttyUSB0 [   64.502343] pl2303 4-1:1.0: device disconnected
> > > [   66.494930] usb 4-1: new full-speed USB device number 3 using
> > > uhci_hcd [   66.654247] usb 4-1: New USB device found, idVendor=067b,
> > > idProduct=2303 [   66.654261] usb 4-1: New USB device strings: Mfr=1,
> > > Product=2, SerialNumber=0
> > > [   66.654269] usb 4-1: Product: USB-Serial Controller
> > > [   66.654276] usb 4-1: Manufacturer: Prolific Technology Inc.
> > > [   66.659661] pl2303 4-1:1.0: pl2303 converter detected
> > > [   66.671587] usb 4-1: pl2303 converter now attached to ttyUSB0
> > > 
> > > 5722  munmap(0x7f1bfc0d7000, 4096)      = 0
> > > 5722  write(2, "2013/01/19 09:36:38 socat[5722] E tcgetattr(3,
> > > 0x7fffeff64020): Inappropriate ioctl for device\n", 95) = 95
> > > 5722  ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
> > > TCGETS, 0x7fffeff63e50) = -1 ENOTTY (Inappropriate ioctl for device)
> > > 5722  write(2, "2013/01/19 09:36:38 socat[5722] E tcgetattr(3,
> > > 0x7fffeff63f90): Inappropriate ioctl for device\n", 95) = 95
> > > 5722  ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
> > > TCGETS, 0x7fffeff63ec0) = -1 ENOTTY (Inappropriate ioctl for device)
> > > 5722  write(2, "2013/01/19 09:36:38 socat[5722] E tcgetattr(3,
> > > 0x7fffeff64160): Inappropriate ioctl for device\n", 95) = 95
> > > 5722  fcntl(3, F_SETFD, FD_CLOEXEC)     = 0
> > > 5722  ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
> > > TCGETS, 0x7fffeff64330) = -1 ENOTTY (Inappropriate ioctl for device)
> > > 5722  select(4, [3], [1], [], NULL)     = 2 (in [3], out [1])
> > 
> > If I unplug the USB device while tty session is running, I will get on
> > next plugin a new devnode ttyUSB1. It seems that you are trying to reuse
> > an old "dead" connection? Could it be rather a udev problem?
> 
> After plugging back in kernel says ttyUSB0 in dmesg ("usb 4-1: pl2303
> converter now attached to ttyUSB0"), not ttyUSB1, so it's not udev problem.
> 
> Also socat exits with error after unplugging (""W cannot restore
> terminal settings on fd 3: Input/output error"") releasing ttyUSB0, so next
> plug in should still use ttyUSB0.
> 
> Tried to reproduce the same problem on my PC and failed. On Thinkpad T400
> I'm reproducing without any problem.

Was able to reproduce on different machine, Asus E35M1-I DELUXE based PC, 3.7.3 kernel,
required few socat + disconnect + replug iterations.

Here it even reads some data all the time "sssATZATZ". ATZ came from minicom,
sss from my keyboard pressing but no clue where it got buffered now. Minicom is turned off,
not pressing "s" anymore, yet I can read that all the time using socat like this:

[root@serarm ~]# socat -ddd -s -u /dev/ttyUSB2,raw,echo=0,b115200,crnl,noctty,nonblock - 
2013/01/20 13:19:10 socat[20565] E tcgetattr(3, 0x7fffca638660): Inappropriate ioctl for device
2013/01/20 13:19:10 socat[20565] E tcgetattr(3, 0x7fffca6385d0): Inappropriate ioctl for device
2013/01/20 13:19:10 socat[20565] E tcgetattr(3, 0x7fffca6387a0): Inappropriate ioctl for device
sssATZATZ#                                                                                                                                                   [root@serarm ~]# socat -ddd -s -u 
/dev/ttyUSB2,raw,echo=0,b115200,crnl,noctty,nonblock - 
2013/01/20 13:19:10 socat[20569] E tcgetattr(3, 0x7fffadc7cd20): Inappropriate ioctl for device
2013/01/20 13:19:10 socat[20569] E tcgetattr(3, 0x7fffadc7cc90): Inappropriate ioctl for device
2013/01/20 13:19:10 socat[20569] E tcgetattr(3, 0x7fffadc7ce60): Inappropriate ioctl for device
sssATZATZ#                                                                                                                                                   [root@serarm ~]# socat -ddd -s -u 
/dev/ttyUSB2,raw,echo=0,b115200,crnl,noctty,nonblock - 
2013/01/20 13:19:11 socat[20570] E tcgetattr(3, 0x7ffffafe2fd0): Inappropriate ioctl for device
2013/01/20 13:19:11 socat[20570] E tcgetattr(3, 0x7ffffafe2f40): Inappropriate ioctl for device
2013/01/20 13:19:11 socat[20570] E tcgetattr(3, 0x7ffffafe3110): Inappropriate ioctl for device
sssATZATZ#     

dmesg:
[606931.578062] usb 4-4: new full-speed USB device number 51 using ohci_hcd
[606931.735206] usb 4-4: New USB device found, idVendor=067b, idProduct=2303
[606931.735223] usb 4-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[606931.735233] usb 4-4: Product: USB-Serial Controller
[606931.735241] usb 4-4: Manufacturer: Prolific Technology Inc.
[606931.738598] pl2303 4-4:1.0: pl2303 converter detected
[606931.759588] usb 4-4: pl2303 converter now attached to ttyUSB2

strace:
http://pastebin.com/wWq7EFkJ

(had 3 adapters in that E35MI system)


Tried to reproduce on third machine (Asus F2J notebook) but wasn't that lucky.

-- 
Arkadiusz Miśkiewicz, arekm / maven.pl

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-01-20 12:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-18 22:28 3.7.3, ttyUSB0 serial problem - devices stop working and only reboot helps (Inappropriate ioctl for device) Arkadiusz Miskiewicz
2013-01-19  0:47 ` Greg Kroah-Hartman
2013-01-19  8:18   ` Arkadiusz Miskiewicz
2013-01-19  8:48     ` Arkadiusz Miskiewicz
2013-01-20  2:19       ` Woody Suwalski
2013-01-20  9:04         ` Arkadiusz Miskiewicz
2013-01-20 12:26           ` Arkadiusz Miskiewicz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.