block usb device from module assignment

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

block usb device from module assignment

gobo
can anyone offer suggestions on how to stop the assignment of a
specific device to a module?

i've tried to write a udev rule, but it seems OPTIONS+="ignore_device"
is no longer valid.

thanks.

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: block usb device from module assignment

E.S. Rosenberg
blacklist the module?
udev syntax may have changed but udev rules should still work too...
You need to be a bit more specific...



2014-05-11 0:33 GMT+03:00 gobo <[hidden email]>:
can anyone offer suggestions on how to stop the assignment of a
specific device to a module?

i've tried to write a udev rule, but it seems OPTIONS+="ignore_device"
is no longer valid.

thanks.

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]




libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: block usb device from module assignment

gobo
i have a breakout board with an FT232RL.  when the board is
attached to ubuntu 12.04lts, udev (i think) grabs it and
assigns the ftdi_sio module.

udevadm info --attribute-walk --name=/dev/ttyUSB0
was used to get the attributes for the device.

with that, wrote the following rule:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001",
ATTRS{serial}=="A800f3Pu", OPTIONS+="ignore_device"

that rule does not work.  after much research, found
http://lwn.net/Articles/364728/:
udev 148
========

The option "ignore_device" does no longer exist. There is no way to
ignore an event, as libudev events can not be suppressed by rules.
It only prevented RUN keys from being executed, which results in an
inconsistent behavior in current setups.

that statement suggests there is not a way to block an action.
blacklisting i suppose.  but if i blacklisted ftdi_sio, then no
ftdi device could be used.

i'm searching for a way to keep one specific board/chip from being
assigned a module so i can work with it in bitbang mode.



On 5/10/14, E.S. Rosenberg <[hidden email]> wrote:

> blacklist the module?
> udev syntax may have changed but udev rules should still work too...
> You need to be a bit more specific...
>
>
>
> 2014-05-11 0:33 GMT+03:00 gobo <[hidden email]>:
>
>> can anyone offer suggestions on how to stop the assignment of a
>> specific device to a module?
>>
>> i've tried to write a udev rule, but it seems OPTIONS+="ignore_device"
>> is no longer valid.
>>
>> thanks.
>>
>> --
>> libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
>> To unsubscribe send a mail to [hidden email]
>>
>>
>
>
> --
> libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
> To unsubscribe send a mail to [hidden email]

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: block usb device from module assignment

Xiaofan Chen
On Sun, May 11, 2014 at 6:36 AM, gobo <[hidden email]> wrote:

> i have a breakout board with an FT232RL.  when the board is
> attached to ubuntu 12.04lts, udev (i think) grabs it and
> assigns the ftdi_sio module.
>
> udevadm info --attribute-walk --name=/dev/ttyUSB0
> was used to get the attributes for the device.
>
> with that, wrote the following rule:
> SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001",
> ATTRS{serial}=="A800f3Pu", OPTIONS+="ignore_device"
>
> that rule does not work.  after much research, found
> http://lwn.net/Articles/364728/:
> udev 148
> ========
>
> The option "ignore_device" does no longer exist. There is no way to
> ignore an event, as libudev events can not be suppressed by rules.
> It only prevented RUN keys from being executed, which results in an
> inconsistent behavior in current setups.
>
> that statement suggests there is not a way to block an action.
> blacklisting i suppose.  but if i blacklisted ftdi_sio, then no
> ftdi device could be used.
>
> i'm searching for a way to keep one specific board/chip from being
> assigned a module so i can work with it in bitbang mode.
>

You can use udev rules to unbind the kernel driver for a specific
device. But it is said to be not 100% reliable.

Ref:
1) http://libusb.6.n5.nabble.com/Automatic-detach-of-a-HID-device-using-udev-Re-How-to-dump-HID-report-descriptor-under-Linux-td3330260.html

2) http://libusb.6.n5.nabble.com/open-device-exclusively-td4524397.html

--
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: block usb device from module assignment

Xiaofan Chen
In reply to this post by gobo
On Sun, May 11, 2014 at 5:33 AM, gobo <[hidden email]> wrote:
> can anyone offer suggestions on how to stop the assignment of a
> specific device to a module?
>
> i've tried to write a udev rule, but it seems OPTIONS+="ignore_device"
> is no longer valid.
>

Other than using udev rules, you can write a simple program
to detach/attach kernel driver using libusb (Linux only).

http://libusb.sourceforge.net/api-1.0/group__dev.html

int libusb_kernel_driver_active (libusb_device_handle *dev, int
interface_number)
 Determine if a kernel driver is active on an interface.

int libusb_detach_kernel_driver (libusb_device_handle *dev, int
interface_number)
 Detach a kernel driver from an interface.

int libusb_attach_kernel_driver (libusb_device_handle *dev, int
interface_number)
 Re-attach an interface's kernel driver, which was previously detached
using libusb_detach_kernel_driver().

int libusb_set_auto_detach_kernel_driver (libusb_device_handle *dev, int enable)
 Enable/disable libusb's automatic kernel driver detachment.


--
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: block usb device from module assignment

Ryan Tennill
What about using a different VID/PID combination? FTDI will allocate a block of 8 PID upon request if you want to use their VID: http://www.ftdichip.com/Support/Knowledgebase/index.html?basicdetails.htm.

You should be able to use the FTDI eeprom tool to set it to whatever you want and prevent the automatic attachment of the ftdi_sio module. It also breaks automatic driver install on Windows if that is an issue.

My first thought was the simple program to detach but it could be annoying to do that every time you reconnect the hardware.

Ryan


Distant Focus Corporation
Champaign, IL 61822
217-351-2655 x126
http://distantfocus.com/projects/



On Sun, 2014-05-11 at 11:08 +0800, Xiaofan Chen wrote:
On Sun, May 11, 2014 at 5:33 AM, gobo <[hidden email]> wrote:
> can anyone offer suggestions on how to stop the assignment of a
> specific device to a module?
>
> i've tried to write a udev rule, but it seems OPTIONS+="ignore_device"
> is no longer valid.
>

Other than using udev rules, you can write a simple program
to detach/attach kernel driver using libusb (Linux only).

http://libusb.sourceforge.net/api-1.0/group__dev.html

int libusb_kernel_driver_active (libusb_device_handle *dev, int
interface_number)
 Determine if a kernel driver is active on an interface.

int libusb_detach_kernel_driver (libusb_device_handle *dev, int
interface_number)
 Detach a kernel driver from an interface.

int libusb_attach_kernel_driver (libusb_device_handle *dev, int
interface_number)
 Re-attach an interface's kernel driver, which was previously detached
using libusb_detach_kernel_driver().

int libusb_set_auto_detach_kernel_driver (libusb_device_handle *dev, int enable)
 Enable/disable libusb's automatic kernel driver detachment.




libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: block usb device from module assignment

Ibrahim Kamal
Using custom VID is good, but if like me, you have to deploy your products on windows too, you loose all driver certifications done by FTDI, hence you loose a big advantage of FTDI chips...

Best regards,

IKALOGIC
ikalogic.com

Ibrahim Kamal
C.E.O. / P.D.G.
TEL: (+33) 555 358 028
GSM: (+33) 641 742 484
FAX: (+33) 972 125 830

IKALOGIC S.A.S. - 1 Avenue d'ESTER
87069 Limoges CEDEX FRANCE SIRET# 522 847 250



Le 12/05/2014 17:12, Ryan Tennill a écrit :
What about using a different VID/PID combination? FTDI will allocate a block of 8 PID upon request if you want to use their VID: http://www.ftdichip.com/Support/Knowledgebase/index.html?basicdetails.htm.

You should be able to use the FTDI eeprom tool to set it to whatever you want and prevent the automatic attachment of the ftdi_sio module. It also breaks automatic driver install on Windows if that is an issue.

My first thought was the simple program to detach but it could be annoying to do that every time you reconnect the hardware.

Ryan


Distant Focus Corporation
Champaign, IL 61822
217-351-2655 x126
http://distantfocus.com/projects/



On Sun, 2014-05-11 at 11:08 +0800, Xiaofan Chen wrote:
On Sun, May 11, 2014 at 5:33 AM, gobo <[hidden email]> wrote:
> can anyone offer suggestions on how to stop the assignment of a
> specific device to a module?
>
> i've tried to write a udev rule, but it seems OPTIONS+="ignore_device"
> is no longer valid.
>

Other than using udev rules, you can write a simple program
to detach/attach kernel driver using libusb (Linux only).

http://libusb.sourceforge.net/api-1.0/group__dev.html

int libusb_kernel_driver_active (libusb_device_handle *dev, int
interface_number)
 Determine if a kernel driver is active on an interface.

int libusb_detach_kernel_driver (libusb_device_handle *dev, int
interface_number)
 Detach a kernel driver from an interface.

int libusb_attach_kernel_driver (libusb_device_handle *dev, int
interface_number)
 Re-attach an interface's kernel driver, which was previously detached
using libusb_detach_kernel_driver().

int libusb_set_auto_detach_kernel_driver (libusb_device_handle *dev, int enable)
 Enable/disable libusb's automatic kernel driver detachment.




libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]





libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: block usb device from module assignment

Ibrahim Kamal
By the way, here is what i do to solve this issue: http://www.ikalogic.com/ftdi-d2xx-linux-overcoming-big-problem/

Works like a charm for us...

Best regards,

IKALOGIC
ikalogic.com

Ibrahim Kamal
C.E.O. / P.D.G.
TEL: (+33) 555 358 028
GSM: (+33) 641 742 484
FAX: (+33) 972 125 830

IKALOGIC S.A.S. - 1 Avenue d'ESTER
87069 Limoges CEDEX FRANCE SIRET# 522 847 250



Le 12/05/2014 17:16, Ibrahim Kamal a écrit :
Using custom VID is good, but if like me, you have to deploy your products on windows too, you loose all driver certifications done by FTDI, hence you loose a big advantage of FTDI chips...

Best regards,

IKALOGIC
ikalogic.com

Ibrahim Kamal
C.E.O. / P.D.G.
TEL: (+33) 555 358 028
GSM: (+33) 641 742 484
FAX: (+33) 972 125 830

IKALOGIC S.A.S. - 1 Avenue d'ESTER
87069 Limoges CEDEX FRANCE SIRET# 522 847 250



Le 12/05/2014 17:12, Ryan Tennill a écrit :
What about using a different VID/PID combination? FTDI will allocate a block of 8 PID upon request if you want to use their VID: http://www.ftdichip.com/Support/Knowledgebase/index.html?basicdetails.htm.

You should be able to use the FTDI eeprom tool to set it to whatever you want and prevent the automatic attachment of the ftdi_sio module. It also breaks automatic driver install on Windows if that is an issue.

My first thought was the simple program to detach but it could be annoying to do that every time you reconnect the hardware.

Ryan


Distant Focus Corporation
Champaign, IL 61822
217-351-2655 x126
http://distantfocus.com/projects/



On Sun, 2014-05-11 at 11:08 +0800, Xiaofan Chen wrote:
On Sun, May 11, 2014 at 5:33 AM, gobo <[hidden email]> wrote:
> can anyone offer suggestions on how to stop the assignment of a
> specific device to a module?
>
> i've tried to write a udev rule, but it seems OPTIONS+="ignore_device"
> is no longer valid.
>

Other than using udev rules, you can write a simple program
to detach/attach kernel driver using libusb (Linux only).

http://libusb.sourceforge.net/api-1.0/group__dev.html

int libusb_kernel_driver_active (libusb_device_handle *dev, int
interface_number)
 Determine if a kernel driver is active on an interface.

int libusb_detach_kernel_driver (libusb_device_handle *dev, int
interface_number)
 Detach a kernel driver from an interface.

int libusb_attach_kernel_driver (libusb_device_handle *dev, int
interface_number)
 Re-attach an interface's kernel driver, which was previously detached
using libusb_detach_kernel_driver().

int libusb_set_auto_detach_kernel_driver (libusb_device_handle *dev, int enable)
 Enable/disable libusb's automatic kernel driver detachment.




libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]





libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]





libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: block usb device from module assignment

Laurent Perez
In reply to this post by Ryan Tennill
* Ryan Tennill <[hidden email]> [2014-05-12 10:12] :

>    My first thought was the simple program to detach but it could be annoying
>    to do that every time you reconnect the hardware.

This program could be run automatically by udev if you add to the rule :

RUN+="/path/to/myprogram"

Cheers ;


Laurent.

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: block usb device from module assignment

Ryan Tennill
True.

One thing to consider is making the rule specific to the hardware so that it isn't applied to other hardware with the same VID/PID pair. I recently encountered this when an optical chopper had the same chip that I use for a control board and I was only keying off VID/PID.

Ryan

Distant Focus Corporation
Champaign, IL 61822
217-351-2655 x126
http://distantfocus.com/projects/


On Tue, 2014-05-13 at 13:28 +0200, Laurent Perez wrote:
* Ryan Tennill <[hidden email]> [2014-05-12 10:12] :

>    My first thought was the simple program to detach but it could be annoying
>    to do that every time you reconnect the hardware.

This program could be run automatically by udev if you add to the rule :

RUN+="/path/to/myprogram"

Cheers ;


Laurent.

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]   



libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: block usb device from module assignment

Laurent Perez
* Ryan Tennill <[hidden email]> [2014-05-13 09:37] :
>    True.
>
>    One thing to consider is making the rule specific to the hardware so that
>    it isn't applied to other hardware with the same VID/PID pair. I recently
>    encountered this when an optical chopper had the same chip that I use for
>    a control board and I was only keying off VID/PID.

Yes, you are right.
What about adding an ATTRS key to the rule ?
udevadm reports this about two of my USB-Serial adapters :

1/
ATTRS{interface}=="US232R"
ATTRS{product}=="US232R"
ATTRS{serial}=="FTEMYQON"

2/
ATTRS{interface}=="TTL232R-3V3"
ATTRS{product}=="TTL232R-3V3"
ATTRS{serial}=="FTE3BZ1P"

Regards ;


Laurent.

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: block usb device from module assignment

gobo
In reply to this post by Ibrahim Kamal
i finally got time to work on this project again.  sorry that it's been awhile.

from the big problem article i used the following rule.  it should
catch a bunch of ftdi devices, which is ok for now.

ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", RUN+="/bin/sh -c
'echo $kernel > /sys/bus/usb/drivers/ftdi_sio/unbind'"

ftdi_sio and usbserial are still being loaded by the kernel.

maybe i'm not understanding what this rule is supposed to do.  $kernel
is an empty string.
echo $kernel | hd
00000000  0a                                                |.|
00000001

is that what needs to be written to unbind?


On 5/12/14, Ibrahim Kamal <[hidden email]> wrote:

> By the way, here is what i do to solve this issue:
> http://www.ikalogic.com/ftdi-d2xx-linux-overcoming-big-problem/
>
> Works like a charm for us...
>
> Best regards,
>
> IKALOGIC
> ikalogic.com <http://www.ikalogic.com/>
>
>
>
> *Ibrahim Kamal*
> C.E.O. / P.D.G.
> TEL: (+33) 555 358 028
> GSM: (+33) 641 742 484
> FAX: (+33) 972 125 830
>
> IKALOGIC S.A.S. - 1 Avenue d'ESTER
> 87069 Limoges CEDEX FRANCE SIRET# 522 847 250
>
>
>

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Loading...