Hello, I use a USB to RS485 converter (ICP Con i-7561, a PL2303 device, details below) to access one RS-485 device via Modbus RTU. I have written a test application using libmodbus which - connects to /dev/ttyUSB0 (modbus_connect) - sets termios - reads an input register from the RS-485 device and - disconnects from /dev/ttyUSB0 (modbus_close). The app runs fine with Ubuntu 9.04, kernel 2.6.28 on my PC. However, I want to run the application on a MIPS device (Fritz!Box) which uses kernel 2.6.13. And there I get a problem if I try to run the application repeatedly. The first run is fine, but any subseqent run fails. Data can be send to the RS485 device but then there is no response. After I reconnect the device physically another run succeeds - and every subsequent run fails again. Running the pl2303 in debug mode I do not see any error messages, the output of the first and second run are mostly equal. Except for the missing read_bulk_callbacks in the second run. See below. Actually I do not know if the converter does not send any data anymore or if the kernel discards the data. On the MIPS device I also ran usbmon, but there was no output. Now I am trying to get output from usbmon on my PC with Ubuntu/2.6.15. What other debugging tools could be helpful in this context? If the converted does not send data anymore it might have been mis-configured, maybe by setting termios connect/disconnect from /dev/ttyUSB0. Otherwise there could be an issue with the read_bulk_callback. Unfortunately, updating the kernel on the MIPS device is not an option. So, I would try to fix the bug for 2.6.13. Therefore I have installed an old Ubuntu with kernel 2.6.15 on my PC and I could reproduce the error there. Now I guess I have to find the relevant changes between 2.6.15 and 2.6.28 and backport them. Of course there has been a lot of development taken place and I skimmed through the git commit messages for pl2303.c but could not identify something meaningful. I would be very glad if someone here would recall a change which could be related to the problem. Also: any hints where I should look in addition to pl2303.c? Thanks Markus ------------------------------ usb info -------------------------------------------------- T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 3 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=067b ProdID=2303 Rev=5a.c3 S: Manufacturer=Prolific Technology Inc. S: Product=USB-Serial Controller S: SerialNumber=00005AC3 C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=pl2303 E: Ad=81(I) Atr=03(Int.) MxPS= 10 Ivl=1ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms ------------------------------ first run -------------------------------------------------- drivers/usb/serial/usb-serial.c: Had to override the open usb serial operation with the generic one. drivers/usb/serial/usb-serial.c: Had to override the write usb serial operation with the generic one. drivers/usb/serial/usb-serial.c: Had to override the close usb serial operation with the generic one. drivers/usb/serial/usb-serial.c: Had to override the write_room usb serial operation with the generic one. drivers/usb/serial/usb-serial.c: Had to override the chars_in_buffer usb serial operation with the generic one. drivers/usb/serial/usb-serial.c: Had to override the read_bulk_callback usb serial operation with the generic one. drivers/usb/serial/usb-serial.c: Had to override the write_bulk_callback usb serial operation with the generic one. drivers/usb/serial/usb-serial.c: USB Serial support registered for Generic drivers/usb/serial/usb-serial.c: USB Serial Driver core v2.0 drivers/usb/serial/usb-serial.c: USB Serial support registered for PL-2303 drivers/usb/serial/usb-serial.c: descriptor matches drivers/usb/serial/usb-serial.c: found interrupt in on endpoint 0 drivers/usb/serial/usb-serial.c: found bulk out on endpoint 1 drivers/usb/serial/usb-serial.c: found bulk in on endpoint 2 pl2303 1-1.2:1.0: PL-2303 converter detected drivers/usb/serial/usb-serial.c: get_free_serial 1 drivers/usb/serial/usb-serial.c: get_free_serial - minor base = 0 drivers/usb/serial/usb-serial.c: usb_serial_probe - setting up 1 port structures for this device drivers/usb/serial/pl2303.c: device type: 2 drivers/usb/serial/usb-serial.c: usb_serial_probe - registering ttyUSB0 usb 1-1.2: PL-2303 converter now attached to ttyUSB0 drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver v0.12 drivers/usb/serial/usb-serial.c: serial_open drivers/usb/serial/pl2303.c: pl2303_open - port 0 drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8484:0x0 1 - 2 drivers/usb/serial/pl2303.c: 0x40:0x1:0x404:0x0 0 drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8484:0x0 1 - 2 drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8383:0x0 1 - 7b drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8484:0x0 1 - 2 drivers/usb/serial/pl2303.c: 0x40:0x1:0x404:0x1 0 drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8484:0x0 1 - 2 drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8383:0x0 1 - 6 drivers/usb/serial/pl2303.c: 0x40:0x1:0x0:0x1 0 drivers/usb/serial/pl2303.c: 0x40:0x1:0x1:0x0 0 drivers/usb/serial/pl2303.c: 0x40:0x1:0x2:0x44 0 drivers/usb/serial/pl2303.c: 0x40:0x1:0x8:0x0 0 drivers/usb/serial/pl2303.c: 0x40:0x1:0x9:0x0 0 drivers/usb/serial/pl2303.c: pl2303_set_termios - port 0 drivers/usb/serial/pl2303.c: 0xa1:0x21:0:0 7 - 80 25 0 0 0 0 0 drivers/usb/serial/pl2303.c: pl2303_set_termios - data bits = 8 drivers/usb/serial/pl2303.c: pl2303_set_termios - baud = 9600 drivers/usb/serial/pl2303.c: pl2303_set_termios - stop bits = 1 drivers/usb/serial/pl2303.c: pl2303_set_termios - parity = none drivers/usb/serial/pl2303.c: 0x21:0x20:0:0 1031 drivers/usb/serial/pl2303.c: set_control_lines - value = 3, retval = 0 drivers/usb/serial/pl2303.c: 0xa1:0x21:0:0 7 - 80 25 0 0 0 0 8 drivers/usb/serial/pl2303.c: pl2303_open - submitting read urb drivers/usb/serial/pl2303.c: pl2303_open - submitting interrupt urb drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x540d drivers/usb/serial/pl2303.c: pl2303_ioctl (0) cmd = 0x540d drivers/usb/serial/pl2303.c: pl2303_ioctl not supported = 0x540d drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x540e drivers/usb/serial/pl2303.c: pl2303_ioctl (0) cmd = 0x540e drivers/usb/serial/pl2303.c: pl2303_ioctl not supported = 0x540e drivers/usb/serial/usb-serial.c: serial_set_termios - port 0 drivers/usb/serial/pl2303.c: pl2303_set_termios - port 0 drivers/usb/serial/pl2303.c: 0xa1:0x21:0:0 7 - 80 25 0 0 0 0 8 drivers/usb/serial/pl2303.c: pl2303_set_termios - data bits = 8 drivers/usb/serial/pl2303.c: pl2303_set_termios - baud = 19200 drivers/usb/serial/pl2303.c: pl2303_set_termios - stop bits = 1 drivers/usb/serial/pl2303.c: pl2303_set_termios - parity = none drivers/usb/serial/pl2303.c: pl2303_read_int_callback (0) PL-2303 ttyUSB0: pl2303_read_int_callback - length = 10, data = a1 20 00 00 00 00 02 00 8b 00 drivers/usb/serial/pl2303.c: 0x21:0x20:0:0 1031 drivers/usb/serial/pl2303.c: 0xa1:0x21:0:0 7 - 0 4b 0 0 0 0 8 drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x540d drivers/usb/serial/pl2303.c: pl2303_ioctl (0) cmd = 0x540d drivers/usb/serial/pl2303.c: pl2303_ioctl not supported = 0x540d drivers/usb/serial/usb-serial.c: serial_write - port 0, 8 byte(s) drivers/usb/serial/pl2303.c: pl2303_write - port 0, 8 bytes drivers/usb/serial/pl2303.c: pl2303_send - port 0 PL-2303 ttyUSB0: pl2303_send - length = 8, data = 01 04 01 00 00 01 30 36 drivers/usb/serial/usb-serial.c: usb_serial_port_softint - port 0 drivers/usb/serial/pl2303.c: pl2303_write_bulk_callback - port 0 drivers/usb/serial/pl2303.c: pl2303_send - port 0 drivers/usb/serial/usb-serial.c: serial_chars_in_buffer = port 0 drivers/usb/serial/pl2303.c: pl2303_chars_in_buffer - port 0 drivers/usb/serial/pl2303.c: pl2303_chars_in_buffer - returns 0 drivers/usb/serial/usb-serial.c: serial_write_room - port 0 drivers/usb/serial/pl2303.c: pl2303_write_room - port 0 drivers/usb/serial/pl2303.c: pl2303_write_room - returns 1023 drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - port 0 PL-2303 ttyUSB0: pl2303_read_bulk_callback - length = 1, data = 01 drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - tty_flag = 0 drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - port 0 PL-2303 ttyUSB0: pl2303_read_bulk_callback - length = 1, data = 04 drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - tty_flag = 0 drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - port 0 PL-2303 ttyUSB0: pl2303_read_bulk_callback - length = 2, data = 02 00 drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - tty_flag = 0 drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - port 0 PL-2303 ttyUSB0: pl2303_read_bulk_callback - length = 2, data = 0f f9 drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - tty_flag = 0 drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - port 0 PL-2303 ttyUSB0: pl2303_read_bulk_callback - length = 1, data = 34 drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - tty_flag = 0 drivers/usb/serial/usb-serial.c: serial_chars_in_buffer = port 0 drivers/usb/serial/pl2303.c: pl2303_chars_in_buffer - port 0 drivers/usb/serial/pl2303.c: pl2303_chars_in_buffer - returns 0 drivers/usb/serial/usb-serial.c: serial_write_room - port 0 drivers/usb/serial/pl2303.c: pl2303_write_room - port 0 drivers/usb/serial/pl2303.c: pl2303_write_room - returns 1023 drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x540e drivers/usb/serial/pl2303.c: pl2303_ioctl (0) cmd = 0x540e drivers/usb/serial/pl2303.c: pl2303_ioctl not supported = 0x540e drivers/usb/serial/usb-serial.c: serial_set_termios - port 0 drivers/usb/serial/pl2303.c: pl2303_set_termios - port 0 drivers/usb/serial/pl2303.c: 0xa1:0x21:0:0 7 - 0 4b 0 0 0 0 8 drivers/usb/serial/pl2303.c: pl2303_set_termios - data bits = 8 drivers/usb/serial/pl2303.c: pl2303_set_termios - baud = 9600 drivers/usb/serial/pl2303.c: pl2303_set_termios - stop bits = 1 drivers/usb/serial/pl2303.c: pl2303_set_termios - parity = none drivers/usb/serial/pl2303.c: 0x21:0x20:0:0 1031 drivers/usb/serial/pl2303.c: 0xa1:0x21:0:0 7 - 80 25 0 0 0 0 8 drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x540d drivers/usb/serial/pl2303.c: pl2303_ioctl (0) cmd = 0x540d drivers/usb/serial/pl2303.c: pl2303_ioctl not supported = 0x540d drivers/usb/serial/usb-serial.c: serial_close - port 0 drivers/usb/serial/pl2303.c: pl2303_close - port 0 drivers/usb/serial/pl2303.c: pl2303_close - shutting down urbs drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - port 0 drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - urb->status = -2 drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - port is closed, exiting. drivers/usb/serial/pl2303.c: pl2303_read_int_callback (0) drivers/usb/serial/pl2303.c: pl2303_read_int_callback - urb shutting down with status: -2 drivers/usb/serial/pl2303.c: set_control_lines - value = 0, retval = 0 ------------------------------ second run -------------------------------------------------- drivers/usb/serial/usb-serial.c: serial_open drivers/usb/serial/pl2303.c: pl2303_open - port 0 drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8484:0x0 1 - 2 drivers/usb/serial/pl2303.c: 0x40:0x1:0x404:0x0 0 drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8484:0x0 1 - 2 drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8383:0x0 1 - 7b drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8484:0x0 1 - 2 drivers/usb/serial/pl2303.c: 0x40:0x1:0x404:0x1 0 drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8484:0x0 1 - 2 drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8383:0x0 1 - 6 drivers/usb/serial/pl2303.c: 0x40:0x1:0x0:0x1 0 drivers/usb/serial/pl2303.c: 0x40:0x1:0x1:0x0 0 drivers/usb/serial/pl2303.c: 0x40:0x1:0x2:0x44 0 drivers/usb/serial/pl2303.c: 0x40:0x1:0x8:0x0 0 drivers/usb/serial/pl2303.c: 0x40:0x1:0x9:0x0 0 drivers/usb/serial/pl2303.c: pl2303_set_termios - port 0 drivers/usb/serial/pl2303.c: 0xa1:0x21:0:0 7 - 80 25 0 0 0 0 8 drivers/usb/serial/pl2303.c: pl2303_set_termios - data bits = 8 drivers/usb/serial/pl2303.c: pl2303_set_termios - baud = 9600 drivers/usb/serial/pl2303.c: pl2303_set_termios - stop bits = 1 drivers/usb/serial/pl2303.c: pl2303_set_termios - parity = none drivers/usb/serial/pl2303.c: 0x21:0x20:0:0 1031 drivers/usb/serial/pl2303.c: set_control_lines - value = 3, retval = 0 drivers/usb/serial/pl2303.c: 0xa1:0x21:0:0 7 - 80 25 0 0 0 0 8 drivers/usb/serial/pl2303.c: pl2303_open - submitting read urb drivers/usb/serial/pl2303.c: pl2303_open - submitting interrupt urb drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x540d drivers/usb/serial/pl2303.c: pl2303_ioctl (0) cmd = 0x540d drivers/usb/serial/pl2303.c: pl2303_ioctl not supported = 0x540d drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x540e drivers/usb/serial/pl2303.c: pl2303_ioctl (0) cmd = 0x540e drivers/usb/serial/pl2303.c: pl2303_ioctl not supported = 0x540e drivers/usb/serial/usb-serial.c: serial_set_termios - port 0 drivers/usb/serial/pl2303.c: pl2303_set_termios - port 0 drivers/usb/serial/pl2303.c: 0xa1:0x21:0:0 7 - 80 25 0 0 0 0 8 drivers/usb/serial/pl2303.c: pl2303_set_termios - data bits = 8 drivers/usb/serial/pl2303.c: pl2303_set_termios - baud = 19200 drivers/usb/serial/pl2303.c: pl2303_set_termios - stop bits = 1 drivers/usb/serial/pl2303.c: pl2303_set_termios - parity = none drivers/usb/serial/pl2303.c: 0x21:0x20:0:0 1031 drivers/usb/serial/pl2303.c: 0xa1:0x21:0:0 7 - 0 4b 0 0 0 0 8 drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x540d drivers/usb/serial/pl2303.c: pl2303_ioctl (0) cmd = 0x540d drivers/usb/serial/pl2303.c: pl2303_ioctl not supported = 0x540d drivers/usb/serial/usb-serial.c: serial_write - port 0, 8 byte(s) drivers/usb/serial/pl2303.c: pl2303_write - port 0, 8 bytes drivers/usb/serial/pl2303.c: pl2303_send - port 0 PL-2303 ttyUSB0: pl2303_send - length = 8, data = 01 04 01 00 00 01 30 36 drivers/usb/serial/usb-serial.c: usb_serial_port_softint - port 0 drivers/usb/serial/pl2303.c: pl2303_write_bulk_callback - port 0 drivers/usb/serial/pl2303.c: pl2303_send - port 0 drivers/usb/serial/usb-serial.c: serial_chars_in_buffer = port 0 drivers/usb/serial/pl2303.c: pl2303_chars_in_buffer - port 0 drivers/usb/serial/pl2303.c: pl2303_chars_in_buffer - returns 0 drivers/usb/serial/usb-serial.c: serial_write_room - port 0 drivers/usb/serial/pl2303.c: pl2303_write_room - port 0 drivers/usb/serial/pl2303.c: pl2303_write_room - returns 1023 drivers/usb/serial/usb-serial.c: serial_chars_in_buffer = port 0 drivers/usb/serial/pl2303.c: pl2303_chars_in_buffer - port 0 drivers/usb/serial/pl2303.c: pl2303_chars_in_buffer - returns 0 drivers/usb/serial/usb-serial.c: serial_write_room - port 0 drivers/usb/serial/pl2303.c: pl2303_write_room - port 0 drivers/usb/serial/pl2303.c: pl2303_write_room - returns 1023 drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x5407 drivers/usb/serial/pl2303.c: pl2303_ioctl (0) cmd = 0x5407 drivers/usb/serial/pl2303.c: pl2303_ioctl not supported = 0x5407 drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x540e drivers/usb/serial/pl2303.c: pl2303_ioctl (0) cmd = 0x540e drivers/usb/serial/pl2303.c: pl2303_ioctl not supported = 0x540e drivers/usb/serial/usb-serial.c: serial_set_termios - port 0 drivers/usb/serial/pl2303.c: pl2303_set_termios - port 0 drivers/usb/serial/pl2303.c: 0xa1:0x21:0:0 7 - 0 4b 0 0 0 0 8 drivers/usb/serial/pl2303.c: pl2303_set_termios - data bits = 8 drivers/usb/serial/pl2303.c: pl2303_set_termios - baud = 9600 drivers/usb/serial/pl2303.c: pl2303_set_termios - stop bits = 1 drivers/usb/serial/pl2303.c: pl2303_set_termios - parity = none drivers/usb/serial/pl2303.c: 0x21:0x20:0:0 1031 drivers/usb/serial/pl2303.c: 0xa1:0x21:0:0 7 - 80 25 0 0 0 0 8 drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x540d drivers/usb/serial/pl2303.c: pl2303_ioctl (0) cmd = 0x540d drivers/usb/serial/pl2303.c: pl2303_ioctl not supported = 0x540d drivers/usb/serial/usb-serial.c: serial_close - port 0 drivers/usb/serial/pl2303.c: pl2303_close - port 0 drivers/usb/serial/pl2303.c: pl2303_close - shutting down urbs drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - port 0 drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - urb->status = -2 drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - port is closed, exiting. drivers/usb/serial/pl2303.c: pl2303_read_int_callback (0) drivers/usb/serial/pl2303.c: pl2303_read_int_callback - urb shutting down with status: -2 drivers/usb/serial/pl2303.c: set_control_lines - value = 0, retval = 0 -- 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