I  can`t  do with  the  URB_GET_MS_FEATURE_DESCRIPTOR  packet  on linux 2.6.30! 





From: libusbx-devel-request
Date: 2012-10-31 16:26
To: libusbx-devel
Subject: libusbx-devel Digest, Vol 8, Issue 39
Send libusbx-devel mailing list submissions to
libusbx-devel@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
or, via email, send a message with subject or body 'help' to
libusbx-devel-requ...@lists.sourceforge.net

You can reach the person managing the list at
libusbx-devel-ow...@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of libusbx-devel digest..."


Today's Topics:

   1. Questions about libusb on OS X (Sven K?hler)
   2. Re: Questions about libusb on OS X (Xiaofan Chen)
   3. Re: Example udev rules file (Xiaofan Chen)
   4. Re: Example udev rules file (Xiaofan Chen)
   5. Re: Building git code on Mac; CMake support? (Xiaofan Chen)
   6. Re: Example udev rules file (David Grant)
   7. Re: Building git code on Mac; CMake support? (Ludovic Rousseau)


----------------------------------------------------------------------

Message: 1
Date: Wed, 31 Oct 2012 00:41:23 +0100
From: Sven K?hler <sven.koeh...@gmail.com>
Subject: [Libusbx-devel] Questions about libusb on OS X
To: libusbx-devel@lists.sourceforge.net
Message-ID: <k6poiu$pmp$1...@ger.gmane.org>
Content-Type: text/plain; charset=ISO-8859-15

Hi,

I'm a developer of the leJOS open source project. We're currently
looking for new ways for talking to USB devices. On Linux, we already
use libusb with great success (however, port to libusb 1.0 and libusbx
is pending). Some issues remain, like the one with
libusb_detach_kernel_driver, which cannot be used reliably. (Explanation
below)

Now on OS X, we need to talk to USB devices. A driver for these devices
might already be installed. So that would probably need to be detached.
Furthermore, the program that uses libusb is not running with elevated
rights. it must be possible for a normal user to talk to these devices
without having any special priviledges.

Now on Linux, most of that is straight forward. In order to grant users
access to certain devices, users are added to certain group and the
matching udev rules are create. What would be the equivalent of that on
OS X?

Now detaching an already active driver is the next problem. On Linux,
libusb_detach_kernel_driver is implement. Well, it suffers from a pretty
annoying issue: libusb can detach libusb. Or as far as I understand: if
libusb detaches a driver, it puts some kind of "general driver" in
charge of the device. And if another process calls
libusb_detach_kernel_driver, then this general driver is detached which
kills the connection to the device for the process which is already
talking to that device. And of course first getting the name of the
attached driver, and then detaching it depending on the name gives birth
to a race condition.
When I mentioned that issue, it was thrown at me, that I should perform
external synchronization. You know, like with serial devices, which you
don't open unless you have locked a certain lock file. Now what's the
default location of the lock files for USB devices?
(Yes, I know that it doesn't exist. It's sarcasm.)

Does a similar issue exist for OS X? I mean if detaching a driver is
possible at all?

Now device I'm talking about is the Lego NXT. Most of the time, it's
some not very specific USB device that doesn't implement any special
profile. But sometimes (in firmware update mode), it claims to be a
cdc_acm device. I believe the driver by Lego handles the device in both
modes.



Regards,
  Sven





------------------------------

Message: 2
Date: Wed, 31 Oct 2012 09:14:15 +0800
From: Xiaofan Chen <xiaof...@gmail.com>
Subject: Re: [Libusbx-devel] Questions about libusb on OS X
To: libusbx-devel@lists.sourceforge.net
Message-ID:
<CAGjSPUDTfXSJCVGKsb3HpyUS9=45kvfpqjb+nymdp9p862d...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Wed, Oct 31, 2012 at 7:41 AM, Sven K?hler <sven.koeh...@gmail.com> wrote:

> Now on OS X, we need to talk to USB devices. A driver for these devices
> might already be installed. So that would probably need to be detached.
> Furthermore, the program that uses libusb is not running with elevated
> rights. it must be possible for a normal user to talk to these devices
> without having any special privileges.

I do not see any problems with privileges under either Mac OS X or
Windows. On the other hand, driver detaching is a big problem for
Windows and even more troublesome under Mac OS X.

> Now on Linux, most of that is straight forward. In order to grant users
> access to certain devices, users are added to certain group and the
> matching udev rules are create. What would be the equivalent of that on
> OS X?

No need to do anything with regard to this point.

> Now detaching an already active driver is the next problem. On Linux,
> libusb_detach_kernel_driver is implement. Well, it suffers from a pretty
> annoying issue: libusb can detach libusb. Or as far as I understand: if
> libusb detaches a driver, it puts some kind of "general driver" in
> charge of the device. And if another process calls
> libusb_detach_kernel_driver, then this general driver is detached which
> kills the connection to the device for the process which is already
> talking to that device. And of course first getting the name of the
> attached driver, and then detaching it depending on the name gives birth
> to a race condition.
> When I mentioned that issue, it was thrown at me, that I should perform
> external synchronization. You know, like with serial devices, which you
> don't open unless you have locked a certain lock file. Now what's the
> default location of the lock files for USB devices?
> (Yes, I know that it doesn't exist. It's sarcasm.)
>
> Does a similar issue exist for OS X? I mean if detaching a driver is
> possible at all?

libusb_detach_kernel_driver is Linux only. It is not supported
under Windows or Mac OS X or BSDs.

You can use a codeless kext to prevent the default driver from
attaching to the device. Of course you will lose the function
associated with the original driver,

>
> Now device I'm talking about is the Lego NXT. Most of the time, it's
> some not very specific USB device that doesn't implement any special
> profile. But sometimes (in firmware update mode), it claims to be a
> cdc_acm device. I believe the driver by Lego handles the device in both
> modes.

For the generic class, you do not need to do anything. For CDC-ACM,
then it is better you do not use libusbx and just use the serial API
for that function (firmware update).

-- 
Xiaofan



------------------------------

Message: 3
Date: Wed, 31 Oct 2012 09:29:30 +0800
From: Xiaofan Chen <xiaof...@gmail.com>
Subject: Re: [Libusbx-devel] Example udev rules file
To: libusbx-devel@lists.sourceforge.net
Message-ID:
<cagjspudrfktapwdkundaqyswonqeraro11hw6yie3a018qp...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Wed, Oct 31, 2012 at 2:25 AM, David Grant <davidgr...@gmail.com> wrote:
> Could someone with write access to the libusbx wiki add this to the
> "Can I run Linux libusbx applications without root privilege?"
> section?
>
> Example udev rules file, call it "10-libusb.rules"
> SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="libusbusers", MODE="0664"
>

I am reluctant to add anything like the above even though
it is quite popular (usually people use plugdev group or
things like that).

Just take a look at the default udev rules
whch is /lib/udev/rules.d/50-udev-default.rules, there is
already provision for libusb device.

# 'libusb' device nodes
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id"

It seems to me that udev developers thought about the group based
method and decided against it.

-- 
Xiaofan



------------------------------

Message: 4
Date: Wed, 31 Oct 2012 09:31:15 +0800
From: Xiaofan Chen <xiaof...@gmail.com>
Subject: Re: [Libusbx-devel] Example udev rules file
To: libusbx-devel@lists.sourceforge.net
Message-ID:
<cagjspuapnsw7xpxtnj1zhrash2yjao9-zjepp6ofp0bu0nn...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Wed, Oct 31, 2012 at 9:29 AM, Xiaofan Chen <xiaof...@gmail.com> wrote:
> On Wed, Oct 31, 2012 at 2:25 AM, David Grant <davidgr...@gmail.com> wrote:
>> Could someone with write access to the libusbx wiki add this to the
>> "Can I run Linux libusbx applications without root privilege?"
>> section?
>>
>> Example udev rules file, call it "10-libusb.rules"
>> SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="libusbusers", 
>> MODE="0664"
>>
>
> I am reluctant to add anything like the above even though
> it is quite popular (usually people use plugdev group or
> things like that).
>
> Just take a look at the default udev rules
> whch is /lib/udev/rules.d/50-udev-default.rules, there is
> already provision for libusb device.
>
> # 'libusb' device nodes
> SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664"
> SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id"
>
> It seems to me that udev developers thought about the group based
> method and decided against it.
>

Of course the problem is that the default rule does not work
well due to the use of MODE="0664". Maybe it is a good idea
to ask in linux-hotplug mailing list to see the recommendation
from udev developers.



-- 
Xiaofan



------------------------------

Message: 5
Date: Wed, 31 Oct 2012 09:51:31 +0800
From: Xiaofan Chen <xiaof...@gmail.com>
Subject: Re: [Libusbx-devel] Building git code on Mac; CMake support?
To: libusbx-devel@lists.sourceforge.net
Message-ID:
<CAGjSPUD+mad00anOV=Jqusz8=zmwvst08owred6aukdd+tr...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Wed, Oct 31, 2012 at 12:55 AM, Ludovic Rousseau
<ludovic.rouss...@gmail.com> wrote:
> It is not (or no more) specific to Mountain Lion.
> I just tried the github code on Snow Leopard using Xcode 4.2 and it
> builds without problem.
>
> Please resynch the repository and try again.

Yes it works for me now. I see that you changed the Base SDK
to "Current OS X". I remember it was "OS X 10.8" before.

Still there is a problem now that I only see 32bit target now,
the valid architecture says i386 and x86_64 but I only
see 32bit target now.

-- 
Xiaofan



------------------------------

Message: 6
Date: Tue, 30 Oct 2012 20:04:02 -0700
From: David Grant <davidgr...@gmail.com>
Subject: Re: [Libusbx-devel] Example udev rules file
To: libusbx-devel@lists.sourceforge.net
Message-ID:
<CAJPFr9Qa-WDw6FYMK+=0mhuwnsuvphmlc21lmscxiqzdnfx...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Tue, Oct 30, 2012 at 6:31 PM, Xiaofan Chen <xiaof...@gmail.com> wrote:
> On Wed, Oct 31, 2012 at 9:29 AM, Xiaofan Chen <xiaof...@gmail.com> wrote:
>> On Wed, Oct 31, 2012 at 2:25 AM, David Grant <davidgr...@gmail.com> wrote:
>>> Could someone with write access to the libusbx wiki add this to the
>>> "Can I run Linux libusbx applications without root privilege?"
>>> section?
>>>
>>> Example udev rules file, call it "10-libusb.rules"
>>> SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="libusbusers", 
>>> MODE="0664"
>>>
>>
>> I am reluctant to add anything like the above even though
>> it is quite popular (usually people use plugdev group or
>> things like that).
>>
>> Just take a look at the default udev rules
>> whch is /lib/udev/rules.d/50-udev-default.rules, there is
>> already provision for libusb device.
>>
>> # 'libusb' device nodes
>> SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664"
>> SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id"
>>
>> It seems to me that udev developers thought about the group based
>> method and decided against it.
>>
>
> Of course the problem is that the default rule does not work
> well due to the use of MODE="0664". Maybe it is a good idea
> to ask in linux-hotplug mailing list to see the recommendation
> from udev developers.

I'm not sure if my way of doing it is the recommended method but I
copied what I used to have to do when I used VirtualBox with USB
devices.

Dave



------------------------------

Message: 7
Date: Wed, 31 Oct 2012 09:25:45 +0100
From: Ludovic Rousseau <ludovic.rouss...@gmail.com>
Subject: Re: [Libusbx-devel] Building git code on Mac; CMake support?
To: libusbx-devel@lists.sourceforge.net
Message-ID:
<CAGstE8CCQzCL-LveSvOE8-TUps0=bfryhde-uo12ybdse56...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

2012/10/31 Xiaofan Chen <xiaof...@gmail.com>:
> On Wed, Oct 31, 2012 at 12:55 AM, Ludovic Rousseau
> <ludovic.rouss...@gmail.com> wrote:
>> It is not (or no more) specific to Mountain Lion.
>> I just tried the github code on Snow Leopard using Xcode 4.2 and it
>> builds without problem.
>>
>> Please resynch the repository and try again.
>
> Yes it works for me now. I see that you changed the Base SDK
> to "Current OS X". I remember it was "OS X 10.8" before.

Great.

> Still there is a problem now that I only see 32bit target now,
> the valid architecture says i386 and x86_64 but I only
> see 32bit target now.

This is because I used ARCHS = $(NATIVE_ARCH)
This is fixed in
https://github.com/LudovicRousseau/libusbx/commit/b2c4e5ae0ba488d14569806398cb9422a08aba49

Bye

-- 
 Dr. Ludovic Rousseau



------------------------------

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct

------------------------------

_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


End of libusbx-devel Digest, Vol 8, Issue 39
********************************************
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to