Date: Thu, 19 Mar 2009 11:11:28 +0900 From: Weongyo Jeong <weongyo.jeong@gmail.com> To: Hans Petter Selasky <hselasky@c2i.net> Cc: Sam Leffler <sam@freebsd.org>, freebsd-usb@freebsd.org, Andrew Thompson <thompsa@freebsd.org> Subject: Re: q: USB_SET_TIMEOUT in ugen. Message-ID: <20090319021128.GC12632@weongyo.cdnetworks.kr> In-Reply-To: <200903181454.18859.hselasky@c2i.net> References: <20090318073032.GA12632@weongyo.cdnetworks.kr> <200903180852.48034.hselasky@c2i.net> <20090318114642.GB12632@weongyo.cdnetworks.kr> <200903181454.18859.hselasky@c2i.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 18, 2009 at 02:54:17PM +0100, Hans Petter Selasky wrote: > On Wednesday 18 March 2009, Weongyo Jeong wrote: > > On Wed, Mar 18, 2009 at 08:52:47AM +0100, Hans Petter Selasky wrote: > > > Hi, > > > > > > On Wednesday 18 March 2009, Weongyo Jeong wrote: > > > > Hello, > > > > > > > > During porting uath(4) to usb2 I found the following code failed to > > > > run: > > > > > > > > data = open("/dev/usb/0.2.2", O_WRONLY, 0); > > > > timeout = UATH_DATA_TIMEOUT; > > > > if (ioctl(data, USB_SET_TIMEOUT, &timeout) < 0) > > > > err(-1, "%s: USB_SET_TIMEOUT(%u)", datadev, > > > > UATH_DATA_TIMEOUT); > > > > > > > > and the error was: > > > > > > > > uathload: /dev/usb/0.2.2: USB_SET_TIMEOUT(1000): Invalid > > > > argument > > > > > > Use the following macro instead: > > > > > > #define USB_SET_TX_TIMEOUT _IOW ('U', 137, int) > > > > > > There also is a match for USB_SET_RX_TIMEOUT . > > > > > > USB_SET_TIMEOUT has been removed. > > > > > > Also don't forget to include "usb_ioctl.h" . > > > > > > Another idea: > > > > > > Port the program to libusb .... > > > > > > > It looks it's ok with calling ioctl(msg, USB_SET_TIMEOUT, ..) to > > > > /dev/usb/0.2.1 > > > > > > > > And the behaviour of program isn't likely with usb1 that it worked well > > > > in usb1. After writing some data into msg and data pipe there was no > > > > any response using read(2). The problem source can be found at:. > > > > > > > > http://perforce.freebsd.org/depotTreeBrowser.cgi?FSPC=//depot/user/weo > > > >ngyo /wireless/src/usr.sbin/uathload&HIDEDEL=NO > > > > > > > > Are there something I missed in here? > > > > > > See hints above. > > > > Thank you for advise. :-) I've solve `Invalid argument' error. However > > the program looks it still doesn't work. All functions the problem used > > are open(2), ioctl(2), read(2) and write(2). I think I can try to use > > libusb but it'd be better if it works again using the above 4 system > > calls. > > > > Is it supported in CURRENT or is it a one of regression? > > > > regards, > > Weongyo Jeong > > What other IOCTL's are used? > > Can you make a debug trace: > > sysctl hw.usb2.ugen.debug=15 > sysctl hw.usb2.dev.debug=15 > > ? It's a simple program so only USB_SET_RX_TIMEOUT and USB_SET_TX_TIMEOUT are set via ioctl(2). And the result is as follows: [root@kkk /usr/p4/w/usr.sbin/uathload]# ./uathload -d /dev/ugen0.2 -v usb2_open:823: fflags=0x00000003 usb2_ref_device:165: usb2_ref_device, cpd=0xc8374bc0 need uref=1 usb2_ref_device:243: ref udev - needed usb2_fifo_create:409: Endpoint device, searching for 0x01 usb2_fifo_create:480: dev_get_pipe(1, 0x0) usb2_fifo_create:507: dev_get_pipe(1, 0x1) usb2_fifo_create:536: fifo index = 0 ugen_open:158: flag=0x1 ugen_open:158: flag=0x2 usb2_ref_device:165: usb2_ref_device, cpd=0xc8374bc0 need uref=0 usb2_ref_device:235: ref write usb2_ref_device:239: ref read usb2_ioctl:1021: fflags=3, cmd=0x80045572 ugen_ioctl:1388: cmd=0x80045572 ugen_ioctl:1566: error=-3 usb2_uref_location:297: ref udev ugen_ioctl_post:1963: cmd=0x80045572 ugen_ioctl_post:2164: error=0 usb2_open:823: fflags=0x00000002 usb2_ref_device:165: usb2_ref_device, cpd=0xc8374740 need uref=1 usb2_ref_device:243: ref udev - needed usb2_fifo_create:409: Endpoint device, searching for 0x02 usb2_fifo_create:480: dev_get_pipe(2, 0x0) usb2_fifo_create:536: fifo index = 2 ugen_open:158: flag=0x2 usb2_ref_device:165: usb2_ref_device, cpd=0xc8374740 need uref=0 usb2_ref_device:235: ref write usb2_ioctl:1021: fflags=2, cmd=0x80045589 ugen_ioctl:1388: cmd=0x80045589 ugen_ioctl:1566: error=-3 usb2_uref_location:297: ref udev ugen_ioctl_post:1963: cmd=0x80045589 ugen_ioctl_post:2164: error=0 Load firmware aru5523.bin (builtisn) to /dev/ugen0b.2 send block 20: 147368 bytes _remainingwrite:1291: usb2_ref_device:165: usb2_ref_device, cpd=0xc8374bc0 need uref=0 usb2_ref_device:235: ref write usb2_ref_device:239: ref read usb2_write:1362: transfer 512 bytes to 0xc8382038 ugen_default_write_callback:434: actlen=0, aframes=0 ugen_default_write_callback:434: actlen=0, aframes=0 ugen_default_write_callback:434: actlen=512, aframes=1 u : dsata...b2_write:1291: usb2_ref_device:165: usb2_ref_device, cpd=0xc8374740 need uref=0 usb2_ref_device:235: ref write usb2_write:1362: transfer 2048 bytes to 0xc839c038 ugen_default_write_callback:434: actlen=0, aframes=0 ugen_default_write_callback:434: actlen=0, aframes=0 ugen_default_write_callback:434: actlen=2048, aframes=1 u : wsait for ack...b2_ref_device:165: usb2_ref_device, cpd=0xc8374bc0 need uref=0 usb2_ref_device:235: ref write usb2_ref_device:239: ref read usb2_read:1222: sleeping ugen_default_read_callback:384: actlen=0, aframes=0 ugen_default_read_callback:384: actlen=0, aframes=0 ugen_read_clear_stall_callback:477: f=0xc4d5b000: stall cleared [...again...] ugen_default_read_callback:384: actlen=0, aframes=0 ugen_default_read_callback:384: actlen=0, aframes=0 ugen_read_clear_stall_callback:477: f=0xc4d5b000: stall cleared [...again...] ugen_default_read_callback:384: actlen=0, aframes=0 ugen_default_read_callback:384: actlen=0, aframes=0 ugen_read_clear_stall_callback:477: f=0xc4d5b000: stall cleared [...again...] [...again...] [...again...] [...after CTRL-C...] ^Cusb2_close:889: cpd=0xc8374bc0 usb2_ref_device:165: usb2_ref_device, cpd=0xc8374bc0 need uref=1 usb2_ref_device:235: ref write usb2_ref_device:239: ref read usb2_ref_device:243: ref udev - needed usb2_fifo_close:803: Sleeping at close! ugen_closugen_default_read_callback:384: actlen=0, aframes=0 e:188: flag=0x1 ugen_close:202: no FIFOs usb2_fifo_close:810: closed ugen_default_write_callback:434: actlen=512, aframes=1 ugen_close:188: flag=0x2 ugen_close:202: no FIFOs usb2_fifo_close:810: closed usb2_close:889: cpd=0xc8374740 usb2_ref_device:165: usb2_ref_device, cpd=0xc8374740 need uref=1 usb2_ref_device:235: ref write usb2_ref_device:243: ref udev - needed ugen_default_write_callback:434: actlen=2048, aframes=1 ugen_close:188: flag=0x2 ugen_close:202: no FIFOs usb2_fifo_close:810: closed regards, Weongyo Jeong
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090319021128.GC12632>