Re: [linux-usb-devel] ark3116: receive returns negative

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jan Engelhardt
Date: Thursday, May 17, 2007 - 7:10 am

Hi Greg,

On May 17 2007 05:45, Greg KH wrote:

ark3116 supports set_termios (0x5402), but does not get_termios 
(0x5401). Not sure how that affects userspace, though.

The 0xFFFFFFB0 looks like a simple formatting error (ark3116.c line 66)
an explicit cast to (unsigned char)buf[0] or (unsigned int) seems 
required.


The -62 only shows up when the cable is already connected when I 
modprobe ark3116. Reinserting it - and no "-62" shows up.
Maybe this is something normal with USB?


(I found that I already need to modprobe usbserial with debug=1,
since ark3116 uses usb_serial_generic_write)


I would have to test with a real serial port. (I do not
have any real port right now, just two cables + adapters.)

What certainly does not work: Connecting two cables to each other, that is,
USB-RS232-GenderChanger-RS232-USB. (1) USB ends connected to the same machine
(2) USB ends connected to different machines. Both (1) and (2) do not work.
The write() seems to succeed, but read() blocks:

# klogconsole -l8 -r0
# ./sertest
[...]
Writing...
drivers/usb/serial/usb-serial.c: serial_write_room - port 0
drivers/usb/serial/generic.c: usb_serial_generic_write_room - port 0
drivers/usb/serial/generic.c: usb_serial_generic_write_room - returns 64
drivers/usb/serial/usb-serial.c: serial_write - port 0, 3 byte(s)
drivers/usb/serial/generic.c: usb_serial_generic_write - port 0
ark3116 ttyUSB0: usb_serial_generic_write - length = 3, data = 66 6f 6f
drivers/usb/serial/generic.c: usb_serial_generic_write_bulk_callback - 
port 0
drivers/usb/serial/usb-serial.c: usb_serial_port_work - port 0
Reading...
(stops)

Source:
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(void)
{
	char bar[4] = {};
	int s0 = open("/dev/ttyUSB0", O_RDWR);
	int s1 = open("/dev/ttyUSB1", O_RDWR);
	if (s0 < 0 || s1 < 0)
		abort();
	printf("Writing...\n");
	write(s0, "foo", 3);
	printf("Reading...\n");
	read(s1, bar, 3);
	printf("Read: %s\n", bar);
	return 0;
}



	Jan
-- 
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ark3116: receive returns negative, Jan Engelhardt, (Wed May 16, 9:04 am)
Re: [linux-usb-devel] ark3116: receive returns negative, Jan Engelhardt, (Thu May 17, 7:10 am)
Re: [linux-usb-devel] ark3116: receive returns negative, Jan Engelhardt, (Thu May 17, 7:51 am)