Hi! google didn't provide any useful help, so...
I am trying to access some measuring devices (currently three) via a serial RS232 link. As the the machine has only one real serial port I'm using USB 1.1->serial convertors based on the Prolific PL-2303X. While I can talk to one external device (although sometimes I get errors probably due to lost characters) the other two do not respond at all (one of these is connected via a nullmodem cable). If I'm using the built-in serial port I have no problems. I am using something like the following program to communicate with the external devices: #include <stdio.h> #include <limits.h> #include <string.h> #include <math.h> #include <time.h> #include <assert.h> #include <stdarg.h> #include <unistd.h> #include <termios.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/ioctl.h> #include <fcntl.h> const char dev_name[] = "/dev/ttyUSB0"; int main() { int dev; struct termios term; int bits; char buf[80]; int l; dev=open(dev_name, O_RDWR); tcgetattr(dev, &term); term.c_lflag &= ~(ICANON | ECHO); term.c_cflag &= ~CRTSCTS; term.c_cflag |= CSTOPB; term.c_cflag &= ~PARENB; term.c_cflag &= ~(CSIZE | HUPCL); term.c_cflag |= CS8; term.c_cflag |= (CLOCAL | CREAD); term.c_iflag &= ~(IXON | IXOFF); term.c_iflag |= (IGNBRK | IGNPAR | INPCK | IXANY); term.c_iflag &= ~(BRKINT | IGNCR | ICRNL | INLCR | ISTRIP | IUCLC | PARMRK); term.c_oflag |= (OPOST); term.c_oflag &= ~(OCRNL | OFILL | OLCUC | ONLCR | ONLRET | ONOCR); term.c_cc[VMIN] = 0; term.c_cc[VTIME] = 30; cfsetispeed(&term, B2400); cfsetospeed(&term, B2400); tcflush(dev, TCIOFLUSH); tcsetattr(dev, TCSANOW, &term); bits = TIOCM_DTR; ioctl(dev, TIOCMBIC, &bits); bits = TIOCM_RTS; ioctl(dev, TIOCMBIS, &bits); tcflush(dev, TCIOFLUSH); printf("Using device file %s\n", dev_name); write(dev, "\xFC", 1); /* Command for the external device to send us a value */ l = read(dev, &buf, 18); buf[l] = '\0'; printf("%d char(s) read. Input: >%s<\n", l, buf); for ( l = 0; l < 18 && buf[l] != '\0' ; ++l ) printf("%d ", buf[l]); printf("\n"); return 0; } Using device file /dev/ttyUSB0 0 char(s) read. Input: >< Using device file /dev/ttyUSB0 0 char(s) read. Input: >< Using device file /dev/ttyUSB0 0 char(s) read. Input: >< Using device file /dev/ttyUSB0 0 char(s) read. Input: >< Using device file /dev/ttyUSB0 0 char(s) read. Input: >< Using device file /dev/ttyUSB0 0 char(s) read. Input: >< Sometimes also values of -16 (decimal) or the character '2' are returned. Proof that the communication is possible via ttyS0 (c-source adjusted accordingly): Using device file /dev/ttyS0 8 char(s) read. Input: > 22.6 < 32 32 32 50 50 46 54 32 The value is in fact a temperature in °C. Here the kernel log (started with "insmod pl2303.ko debug=1"): Mar 31 10:31:51 linux kernel: drivers/usb/serial/usb-serial.c: USB Serial deregistering driver PL-2303 Mar 31 10:32:01 linux kernel: drivers/usb/serial/usb-serial.c: USB Serial support registered for PL-2303 Mar 31 10:32:01 linux kernel: pl2303 1-2:1.0: PL-2303 converter detected Mar 31 10:32:01 linux kernel: usb 1-2: PL-2303 converter now attached to ttyUSB0 (or usb/tts/0 for devfs) Mar 31 10:32:01 linux kernel: drivers/usb/core/usb.c: registered new driver pl2303 Mar 31 10:32:01 linux kernel: drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver v0.10 Mar 31 10:32:01 linux /etc/hotplug/tty.agent[2740]: add tty device /class/tty/ttyUSB0 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_open - port 0 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8484:0x0 1 - 2 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: 0x40:0x1:0x404:0x0 0 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8484:0x0 1 - 2 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8383:0x0 1 - 0 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8484:0x0 1 - 2 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: 0x40:0x1:0x404:0x1 0 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8484:0x0 1 - 2 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: 0xc0:0x1:0x8383:0x0 1 - 0 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_set_termios - port 0 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: 0xa1:0x21:0:0 7 - 60 9 0 0 2 0 8 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_set_termios - data bits = 8 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_set_termios - baud = 9600 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_set_termios - stop bits = 1 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_set_termios - parity = none Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: 0x21:0x20:0:0 7 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: set_control_lines - value = 3, retval = 0 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: 0xa1:0x21:0:0 7 - 80 25 0 0 0 0 8 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_open - submitting read urb Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_open - submitting interrupt urb Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_ioctl (0) cmd = 0x5401 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_ioctl not supported = 0x5401 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_ioctl (0) cmd = 0x540b Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_ioctl not supported = 0x540b Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_ioctl (0) cmd = 0x5402 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_ioctl not supported = 0x5402 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_set_termios - port 0 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: 0xa1:0x21:0:0 7 - 80 25 0 0 0 0 8 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_set_termios - data bits = 8 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_set_termios - baud = 2400 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_set_termios - stop bits = 2 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_set_termios - parity = none Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: 0x21:0x20:0:0 7 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: 0xa1:0x21:0:0 7 - 60 9 0 0 2 0 8 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_ioctl (0) cmd = 0x5401 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_ioctl not supported = 0x5401 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: set_control_lines - value = 2, retval = 0 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: set_control_lines - value = 2, retval = 0 Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_ioctl (0) cmd = 0x540b Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_ioctl not supported = 0x540b Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_write - port 0, 1 bytes Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_write - length = 1, data = fc Mar 31 10:32:38 linux kernel: drivers/usb/serial/pl2303.c: pl2303_write_bulk_callback - port 0 Mar 31 10:32:41 linux kernel: drivers/usb/serial/pl2303.c: pl2303_close - port 0 Mar 31 10:32:41 linux kernel: drivers/usb/serial/pl2303.c: pl2303_close - shutting down urbs Mar 31 10:32:41 linux kernel: drivers/usb/serial/pl2303.c: pl2303_close - usb_unlink_urb (write_urb) failed with reason: -43 Mar 31 10:32:41 linux kernel: drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - port 0 Mar 31 10:32:41 linux kernel: drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - urb->status = -2 Mar 31 10:32:41 linux kernel: drivers/usb/serial/pl2303.c: pl2303_read_bulk_callback - port is closed, exiting. Mar 31 10:32:41 linux kernel: drivers/usb/serial/pl2303.c: pl2303_read_int_callback (0) Mar 31 10:32:41 linux kernel: drivers/usb/serial/pl2303.c: pl2303_read_int_callback - urb shutting down with status: -2 Mar 31 10:51:50 linux -- MARK -- Mar 31 10:59:00 linux /USR/SBIN/CRON[2812]: (root) CMD ( rm -f /var/spool/cron/lastrun/cron.hourly) Here the output of "cat /proc/bus/usb/devices_please-use-sysfs-instead": T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0 D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=0000 ProdID=0000 Rev= 2.06 S: Manufacturer=Linux 2.6.4-52-default uhci_hcd S: Product=UHCI Host Controller S: SerialNumber=0000:00:07.2 C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=255ms T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 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= 3.00 S: Manufacturer=Prolific Technology Inc. S: Product=USB-Serial Controller 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 System is SUSE 9.1 Linux linux 2.6.4-52-default #1 Wed Apr 7 02:08:30 UTC 2004 i686 i686 i386 GNU/Linux Any help is greatly appreciated (I have to meet a deadline next week)! Best regards, Oliver ------------------------------------------------------- This SF.net email is sponsored by Demarc: A global provider of Threat Management Solutions. Download our HomeAdmin security software for free today! http://www.demarc.com/info/Sentarus/hamr30 _______________________________________________ Linux-usb-users@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-users