Graeme Gill | 1 May 2006 04:19

bulk_write & read problems under OSX and Linux

Hi,
	I'm in the process of porting an application
that communicates with a harware device using a serial port,
over to using USB. The device is pretty simple, it has
two end points, and you send ASCII messages to and fro
using bulk write and read, very similar to a serial port.

I've managed to get it working to some degree using LibUSB-win32,
but have number of problems using LibUSB (0.1.12) under OSX & Linux.

Under OSX (10.3.9), the problem is that small messages get through
successfully, but larger messages have the first packet
missing - ie. I expect to receive a 23 byte message,
but I get 15 bytes, the first 8 having gone missing.

(BTW, libusb.a isn't quite built right - the linker
  complains about the contents table being out of date,
  and I have to run ranlib on it to make it work.)

Under Linux, (White Box Enterprise Linux release 4), I have
a different problem (this is using the same code as
used for OSX). Neither bulk read, nor bulk write
work, both return error -22 "error submitting URB: Invalid argument".

Now of course, I'm not playing with URB's, that's something in
libusb linux.c. I've looked at the arguments to the bulk read and
write calls, and there doesn't seem anything obviously wrong
with these.

I do a couple of usb_control_msg() USB_REQ_GET_STATUS
(Continue reading)

Timo Juhani Lindfors | 1 May 2006 14:18
Picon
Picon
Favicon
Gravatar

V1_0_DEVEL: libusb.so: undefined reference to `usbi_parse_device_descriptor'

Hi,

I tried to build V1_0_DEVEL brach from cvs to port my scripts to use
the new API and isochronous transfers. However, the build failed with
the following messages on a debian sarge system. Please let me know if
you can't reproduce the problem so that I can provide more info.

$ cvs -z3 -d:pserver:anonymous <at> cvs.sourceforge.net:/cvsroot/libusb co -P -rV1_0_DEVEL libusb
$ cd libusb
$ ./autogen.sh
I am going to run ./configure with no arguments - if you wish
to pass any to it, please specify them on the ./autogen.sh command line.
You should add the contents of `/usr/share/aclocal/libtool.m4' to `aclocal.m4'.
autoheader: WARNING: Using auxiliary files such as `acconfig.h', `config.h.bot'
autoheader: WARNING: and `config.h.top', to define templates for `config.h.in'
autoheader: WARNING: is deprecated and discouraged.
autoheader:
autoheader: WARNING: Using the third argument of `AC_DEFINE' and
autoheader: WARNING: `AC_DEFINE_UNQUOTED' allows to define a template without
autoheader: WARNING: `acconfig.h':
autoheader:
autoheader: WARNING:   AC_DEFINE([NEED_FUNC_MAIN], 1,
autoheader:             [Define if a function `main' is needed.])
autoheader:
autoheader: WARNING: More sophisticated templates can also be produced, see the
autoheader: WARNING: documentation.
automake: configure.in: installing `./install-sh'
automake: configure.in: installing `./mkinstalldirs'
automake: configure.in: installing `./missing'
checking for a BSD-compatible install... /usr/bin/install -c
(Continue reading)

Graeme Gill | 1 May 2006 15:22

Re: bulk_write & read problems under OSX and Linux

Graeme Gill wrote:
> Under OSX (10.3.9), the problem is that small messages get through
> successfully, but larger messages have the first packet
> missing - ie. I expect to receive a 23 byte message,
> but I get 15 bytes, the first 8 having gone missing.

Update to this - the first message from the device to
the host gets through OK, but second and subsequent
messages have the first 8 bytes missing from them.

- GG.

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Graeme Gill | 1 May 2006 17:29

Re: bulk_write & read problems under OSX and Linux

OK, to answer my own problems, I found:

I'd been mislead by some old documentation into thinking
that the endpoints needed bulk read/write, when in fact
they are interrupt. Win32 and OSX didn't care, Linux
was fussy, and noticed the mismatch, hence the -22 error.

For the other problem, I discovered what triggers it,
but not what the cause is. The serial interface code
the driver was based on, had some re-syncronise safety
code that attempts to flush any messages from the device
before issuing a new command. So on USB this translates
to doing an interrupt read, when there isn't a
packet ready from the device (so the read expectedly
times out, and the timeout is ignored). Checking again,
this triggers a loss of the first packed of the next
read on all three platforms. This suggests that it
might be the device causing this behaviour.

Graeme Gill.

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Tim Roberts | 1 May 2006 17:48

Re: V1_0_DEVEL: libusb.so: undefined reference to `usbi_parse_device_descriptor'

Timo Juhani Lindfors wrote:

>Hi,
>
>I tried to build V1_0_DEVEL brach from cvs to port my scripts to use
>the new API and isochronous transfers. However, the build failed with
>the following messages on a debian sarge system. Please let me know if
>you can't reproduce the problem so that I can provide more info.
>  
>

The cvs archive is no longer being maintained.  The libusb source is now
in svn.

However, when I did my build a month ago, this problem also existed
there.  It looked like there was a partial checkin;
usbi_parse_device_descriptor was supposed to be moved out of its old
location into linux.c, but it didn't get added.  I just copied it from
its old location into linux.c, and all was well.

I filed a bug report on it, but I haven't followed up; it may have been
fixed by this time.

--

-- 
Tim Roberts, timr <at> probo.com
Providenza & Boekelheide, Inc.

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
(Continue reading)

Gerard Klaver | 1 May 2006 17:55
Picon

Re: V1_0_DEVEL: libusb.so: undefined reference to `usbi_parse_device_descriptor'

On Mon, 2006-05-01 at 08:48 -0700, Tim Roberts wrote:
> Timo Juhani Lindfors wrote:
> 
> >Hi,
> >
> >I tried to build V1_0_DEVEL brach from cvs to port my scripts to use
> >the new API and isochronous transfers. However, the build failed with
> >the following messages on a debian sarge system. Please let me know if
> >you can't reproduce the problem so that I can provide more info.
> >  
> >
> 
> The cvs archive is no longer being maintained.  The libusb source is now
> in svn.
> 
> However, when I did my build a month ago, this problem also existed
> there.  It looked like there was a partial checkin;
> usbi_parse_device_descriptor was supposed to be moved out of its old
> location into linux.c, but it didn't get added.  I just copied it from
> its old location into linux.c, and all was well.
> 
> I filed a bug report on it, but I haven't followed up; it may have been
> fixed by this time.
> 

Do you have a application running in isochronous mode yet?

--

-- 
--
--------
(Continue reading)

Gerard Klaver | 1 May 2006 20:27
Picon

sequence usb commands send, receive

Hello,

I have a question about usb commands, how to handle with libusb.
I have for example the following sequence:

send urb 5, send urb 6, send/receive urb7, send/receive urb8, receive
urb 5, receive urb6

At this moment i don't know how te handle this.
send urb 5, 6 no problem, send/receive urb 7, 8 no problem, but how to
handle to receive urb 5 and 6?.

Does anybody has an idea?

With regards.
--

-- 
--
--------
m.vr.gr.
Gerard Klaver

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Timo Juhani Lindfors | 2 May 2006 00:20
Picon
Picon
Favicon
Gravatar

Re: V1_0_DEVEL: libusb.so: undefined reference to `usbi_parse_device_descriptor'

Hi,

On Mon, May 01, 2006 at 08:48:45AM -0700, Tim Roberts wrote:
> The cvs archive is no longer being maintained.  The libusb source is now
> in svn.

Ok, that explains. I submitted a bug report to fix index.html to
mention SVN.

> However, when I did my build a month ago, this problem also existed
> there.  It looked like there was a partial checkin;
> usbi_parse_device_descriptor was supposed to be moved out of its old
> location into linux.c, but it didn't get added.  I just copied it from
> its old location into linux.c, and all was well.
> 
> I filed a bug report on it, but I haven't followed up; it may have been
> fixed by this time.

Ok, I'll re-test this when I get the latest version from SVN.

best regards,
Timo Lindfors

Timo Juhani Lindfors | 2 May 2006 00:22
Picon
Picon
Favicon
Gravatar

Re: V1_0_DEVEL: libusb.so: undefined reference to `usbi_parse_device_descriptor'

Hi,

On Mon, May 01, 2006 at 05:55:14PM +0200, Gerard Klaver wrote:
> Do you have a application running in isochronous mode yet?

Would be very interesting to see some simple example program that uses
isochronous transfers. I haven't been able to test the SVN version yet
and the stable branch does not do isochronous stuff.

best regards,
Timo Lindfors
Johannes Erdfelt | 2 May 2006 00:25

Re: V1_0_DEVEL: libusb.so: undefined reference to `usbi_parse_device_descriptor'

On Tue, May 02, 2006, Timo Juhani Lindfors <timo.lindfors <at> iki.fi> wrote:
> Hi,
> 
> On Mon, May 01, 2006 at 05:55:14PM +0200, Gerard Klaver wrote:
> > Do you have a application running in isochronous mode yet?
> 
> Would be very interesting to see some simple example program that uses
> isochronous transfers. I haven't been able to test the SVN version yet
> and the stable branch does not do isochronous stuff.

The development branch doesn't have isochronous transfer yet either.
More importantly, the I/O core needs some more fixes to be stable.

Once that is fixed, then isochronous transfer should be pretty
straightforward.

JE

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Gmane