[prev in list] [next in list] [prev in thread] [next in thread] 

List:       libusb-devel
Subject:    Re: USB device lock in linux
From:       Xiaofan Chen <xiaofanc () gmail ! com>
Date:       2013-03-25 5:22:28
Message-ID: CAGjSPUDNTQEM6s4r_4_yPn05nxCk+SJb38Ptg-7z2vap8jvG0Q () mail ! gmail ! com
[Download RAW message or body]

On Mon, Mar 25, 2013 at 10:36 AM, othiyappan <othiyaa96@gmail.com> wrote:
> One clarifcation,we can use libusb to lock the physical device for
> exclusive access?

No.

But maybe it depends on what you mean by "lock the physical device for
exclusive access". Please clarify.

In you original example,  a USB mass storage device is mounted as /dev/sdb
under Linux, if you want to use libusb, you need to detach the original driver
(with proper permission) and then your libusb based application to talk to it.
In that case, it will lose its original functionality of a USB mass
storage device
-- it will no longer be mounted as /dev/sdb.

And when your libusb program claim the interface, it will gain kind of
"exclusive access" since other application will not be able to claim the
interface to carry out some read/write access. Is this what you want?

Even without claiming the interface, some applications (eg: lsusb) are still
allow to access the device like carrying out some control transfer to
the device.

And to make things more complicated, there is this
libusb_detach_kernel_driver() call.
http://libusb.6.n5.nabble.com/open-device-exclusively-td4524397.html

So in the end, libusb is not the right tool to limit USB device
access if your goal is to achieve that.

-- 
Xiaofan

------------------------------------------------------------------------------
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_d2d_mar
_______________________________________________
libusb-devel mailing list
libusb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic