[Libusbx-devel] Major problems using libusbx on CentOS 5

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Libusbx-devel] Major problems using libusbx on CentOS 5

Judd Taylor
I've got a big (and late) project that needs to use libusb/libusbx to ingest data from a satellite demodulator.

I need async capability, as well as the ability to talk via two different logical interfaces via different processes, even through they are on the same USB interface (logical interface 1 is a control channel, with an IN/OUT EP, and logical interface 2 is the data channel with an IN endpoint). I know it's retarded they are on the same USB interface, but I can handle this with forking after claim_interface() (I think).

My main problem is in getting a working version of this library. I'm using CentOS5 (which can't be changed for other reasons), and the latest version of the libusbx simply don't work at all for me due to hotplug issues. The problem I'm getting is that it assumes I have netlink if I configure libusbx with --enable-udev=no. I have to use --enable-udev=no because while there is an early udev available, there is no way libudev.h will ever be available for this OS release.

However, netlink isn't there either, so what I really need to do is to disable hotplug altogether, and I don't see any way to do this.


So after fighting the above problem in 1.0.17 of libusbx, I ended up trying to move the project forward by going back releases until I found something that worked. This is libusb-1.0.8. HOWEVER, now in my latest testing, it seems I can't get the async data ingest thread to terminate properly, seemingly due to a race condition bug in that old version of libusb. (libusb_handle_events() is all that is available).

So it seems I'm stuck between a rock and a hard place here. I can't use the old version of libusb (1.0.8) because it's async stuff is racy/broken, and I can't use the new libusbx stuff since it won't get past libusb_init().


Can anyone help me with this? Maybe via a patch that completely disables hotplug?


PS: I'm using this through Perl, via a new XS level language extension that I'm writing. I have this working with the async callbacks (which was a nightmare in itself).

Thanks,
    Judd

____________________________
Judd Taylor
Software Engineer

Orbital Systems, Ltd.

3807 Carbon Rd.
Irving, TX 75038-3415

(972) 915-3669 x127

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] Major problems using libusbx on CentOS 5

Chris Dickens
You are going to have trouble using the same interface from two different processes. Linux maintains exclusive access for a process once it has claimed an interface until it is released or the file descriptor is closed (either intentionally or from the process exiting). If you claim the interface in the parent, you'll get EBUSY in the child.

As far as hotplug goes, I'm sorry to not be helpful there.

Chris

On Saturday, January 25, 2014, Judd Taylor <[hidden email]> wrote:
I've got a big (and late) project that needs to use libusb/libusbx to ingest data from a satellite demodulator.

I need async capability, as well as the ability to talk via two different logical interfaces via different processes, even through they are on the same USB interface (logical interface 1 is a control channel, with an IN/OUT EP, and logical interface 2 is the data channel with an IN endpoint). I know it's retarded they are on the same USB interface, but I can handle this with forking after claim_interface() (I think).

My main problem is in getting a working version of this library. I'm using CentOS5 (which can't be changed for other reasons), and the latest version of the libusbx simply don't work at all for me due to hotplug issues. The problem I'm getting is that it assumes I have netlink if I configure libusbx with --enable-udev=no. I have to use --enable-udev=no because while there is an early udev available, there is no way libudev.h will ever be available for this OS release.

However, netlink isn't there either, so what I really need to do is to disable hotplug altogether, and I don't see any way to do this.


So after fighting the above problem in 1.0.17 of libusbx, I ended up trying to move the project forward by going back releases until I found something that worked. This is libusb-1.0.8. HOWEVER, now in my latest testing, it seems I can't get the async data ingest thread to terminate properly, seemingly due to a race condition bug in that old version of libusb. (libusb_handle_events() is all that is available).

So it seems I'm stuck between a rock and a hard place here. I can't use the old version of libusb (1.0.8) because it's async stuff is racy/broken, and I can't use the new libusbx stuff since it won't get past libusb_init().


Can anyone help me with this? Maybe via a patch that completely disables hotplug?


PS: I'm using this through Perl, via a new XS level language extension that I'm writing. I have this working with the async callbacks (which was a nightmare in itself).

Thanks,
    Judd

____________________________
Judd Taylor
Software Engineer

Orbital Systems, Ltd.

3807 Carbon Rd.
Irving, TX 75038-3415

(972) 915-3669 x127

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] Major problems using libusbx on CentOS 5

Alan Stern
On Sat, 25 Jan 2014, Chris Dickens wrote:

> You are going to have trouble using the same interface from two different
> processes. Linux maintains exclusive access for a process once it has
> claimed an interface until it is released or the file descriptor is closed
> (either intentionally or from the process exiting).

That's not true at all.  Linux maintains exclusive access for an _open
file reference_ once an interface has been claimed.  Not for a process.

> If you claim the
> interface in the parent, you'll get EBUSY in the child.

Since open file references are shared between a parent and a child,
there should be no problem.

Alan Stern


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] Major problems using libusbx on CentOS 5

Tim Roberts
In reply to this post by Judd Taylor
Judd Taylor wrote:
I've got a big (and late) project that needs to use libusb/libusbx to ingest data from a satellite demodulator.

I need async capability, as well as the ability to talk via two different logical interfaces via different processes, even through they are on the same USB interface (logical interface 1 is a control channel, with an IN/OUT EP, and logical interface 2 is the data channel with an IN endpoint). I know it's retarded they are on the same USB interface, but I can handle this with forking after claim_interface() (I think).

My main problem is in getting a working version of this library. I'm using CentOS5 (which can't be changed for other reasons),...

CentOS 5 uses the 2.6.18 Linux kernel.  It's not impossible that your troubles are due to the antiquity of your kernel, and not the interface you are using to get to it.  The USB kernel support evolved rather dramatically through the 2.6 kernels.


So it seems I'm stuck between a rock and a hard place here. I can't use the old version of libusb (1.0.8) because it's async stuff is racy/broken, and I can't use the new libusbx stuff since it won't get past libusb_init().

It may be sacrilege to mention it here, but it's not really all that hard to code directly to the usbfs ioctls, and that way you have complete control over your destiny.
-- 
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] Major problems using libusbx on CentOS 5

Pradeepa Senanayake

Talking of accessing ioctls directly, willnyou able to provide a.few number of references on this. Like how to access driver ioctls etc. I have experience in very small driver dev on linux and none on wondows. So a lil head start would be wonderfuk i you people have time. Thank you.

On Jan 27, 2014 11:54 PM, "Tim Roberts" <[hidden email]> wrote:
Judd Taylor wrote:
I've got a big (and late) project that needs to use libusb/libusbx to ingest data from a satellite demodulator.

I need async capability, as well as the ability to talk via two different logical interfaces via different processes, even through they are on the same USB interface (logical interface 1 is a control channel, with an IN/OUT EP, and logical interface 2 is the data channel with an IN endpoint). I know it's retarded they are on the same USB interface, but I can handle this with forking after claim_interface() (I think).

My main problem is in getting a working version of this library. I'm using CentOS5 (which can't be changed for other reasons),...

CentOS 5 uses the 2.6.18 Linux kernel.  It's not impossible that your troubles are due to the antiquity of your kernel, and not the interface you are using to get to it.  The USB kernel support evolved rather dramatically through the 2.6 kernels.


So it seems I'm stuck between a rock and a hard place here. I can't use the old version of libusb (1.0.8) because it's async stuff is racy/broken, and I can't use the new libusbx stuff since it won't get past libusb_init().

It may be sacrilege to mention it here, but it's not really all that hard to code directly to the usbfs ioctls, and that way you have complete control over your destiny.
-- 
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] Major problems using libusbx on CentOS 5

Judd Taylor
In reply to this post by Tim Roberts

CentOS 5 is indeed clunky at this day and age, but I can't change it at this point, and I'm not even sure where to go from here. All of my software is RPM based, but CentOS6 is basically terrible. This is basically a multinational enterprise environment, so it's a big deal to change OS versions, and generally requires sending hard drives out to all of our customers with everything preinstalled. Yeah, not cheap. Once upon a time, the idea was that you'd be able to upgrade from like RHEL5 to RHEL6 via yum or RPM, but still waiting on that to materialize properly.

 

In any event, I was able to get the code working (mostly, still a big or two) with libusb 1.0.9. The last version I will ever be able to use will be 1.0.15, I suppose, since that's where hotplug via netlink or libudev becomes mandatory. It's not particularly clear how to implement a single threaded async loop termination via the handle_events_completed() call, BTW. That was the main issue.

 

It's worth noting that I had hotplug working great with CentOS5 libusb 0.1, using udev scripts. I may be able to use that same setup on this implementation. I had to ditch that because there was no async support.

 

I'm not doing direct usbfs for this application. I have no time to start from scratch, yet again.

 

-Judd

 

____________________________
Judd Taylor
Software Engineer

Orbital Systems, Ltd.

3807 Carbon Rd.
Irving, TX 75038-3415

(972) 915-3669 x127

From: Tim Roberts [[hidden email]]
Sent: Monday, January 27, 2014 12:23 PM
To: [hidden email]
Subject: Re: [Libusbx-devel] Major problems using libusbx on CentOS 5

Judd Taylor wrote:
I've got a big (and late) project that needs to use libusb/libusbx to ingest data from a satellite demodulator.

I need async capability, as well as the ability to talk via two different logical interfaces via different processes, even through they are on the same USB interface (logical interface 1 is a control channel, with an IN/OUT EP, and logical interface 2 is the data channel with an IN endpoint). I know it's retarded they are on the same USB interface, but I can handle this with forking after claim_interface() (I think).

My main problem is in getting a working version of this library. I'm using CentOS5 (which can't be changed for other reasons),...

CentOS 5 uses the 2.6.18 Linux kernel.  It's not impossible that your troubles are due to the antiquity of your kernel, and not the interface you are using to get to it.  The USB kernel support evolved rather dramatically through the 2.6 kernels.


So it seems I'm stuck between a rock and a hard place here. I can't use the old version of libusb (1.0.8) because it's async stuff is racy/broken, and I can't use the new libusbx stuff since it won't get past libusb_init().

It may be sacrilege to mention it here, but it's not really all that hard to code directly to the usbfs ioctls, and that way you have complete control over your destiny.
-- 
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] Major problems using libusbx on CentOS 5

Tim Roberts
In reply to this post by Pradeepa Senanayake
Pradeepa Senanayake wrote:
>
> Talking of accessing ioctls directly, willnyou able to provide a.few
> number of references on this. Like how to access driver ioctls etc. I
> have experience in very small driver dev on linux and none on wondows.
> So a lil head start would be wonderfuk i you people have time.
>

On Windows, you can't use ioctls.  There is no generic driver.  If
you're not going to use libusb, then you have to use WinUSB.

On Linux, there's a basic introduction to the usbfs ioctls here:
    http://tali.admingilde.org/linux-docbook/usb/ch07.html
    http://tali.admingilde.org/linux-docbook/usb/ch07s06.html

HOWEVER, don't start down this path unless you really can't use libusb
for some really good reason.  If you are not comfortable with ioctls,
this is not a good way to go.

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.


------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] Major problems using libusbx on CentOS 5

Chris Dickens
Hi Judd,

Attached is a patch to remove hotplug functionality from the Linux backend, while still retaining all other fixes. This essentially gives you 1.0.18 without hotplug.

If you have time to try it, please let me know how it works out.

Chris

------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

0001-Remove-hotplug-functionality-for-Linux-backend.patch (22K) Download Attachment
Loading...