[opensuse] Re: blacklisting device by ID in udev rules?
j debert wrote:
PNY Attache 1Gb flash stick: ~ ID 0930:6540 Toshiba Corp ~ This is the main flash disk part.. It cannot be mounted when the ~ "U3 SMART" partition is mounted. ~ usb-0930_USB_Flash_Memory_0F10CB6881E1992A-0:0 ~ usb-0930_USB_Flash_Memory_0F10CB6881E1992A-0:0-part1
~ The "U3 SMART" media part of the flash drive. Windoze autoruns ~ this ISO partition to use the flash device. ~ usb-0930_USB_Flash_Memory_0F10CB6881E1992A-0:1
This last device is the one to be blacklisted.
How can I blacklist the device using the ID so it is never mounted?
Basically, you need to place a udev rule in /etc/udev/rules.d that looks like SUBSYSTEM=="usb", SYSFS{XYZ}== OPTIONS="ignore_device" You need to look for a sysfs attribute that identiefies your U3 media part. I can't tell from your email what could be used here. Your best bet is: Identify with lsusb the bus/device number. cd to /sys/class/usb_device/usbdev<bus>.<device>/device. This was a symlink, cd to its real dir: cd `/bin/pwd`. Call udevinfo -q all -a -p ~+ This gets an output like looking at class device '/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-7': KERNEL=="1-7" SUBSYSTEM=="unknown" SYSFS{bConfigurationValue}=="1" SYSFS{bDeviceClass}=="00" SYSFS{bDeviceProtocol}=="00" SYSFS{bDeviceSubClass}=="00" SYSFS{bMaxPacketSize0}=="64" SYSFS{bMaxPower}==" 70mA" SYSFS{bNumConfigurations}=="1" SYSFS{bNumInterfaces}==" 1" SYSFS{bcdDevice}=="0104" SYSFS{bmAttributes}=="80" SYSFS{configuration}=="" SYSFS{devnum}=="12" SYSFS{idProduct}=="070b" SYSFS{idVendor}=="05e3" SYSFS{manufacturer}=="General " SYSFS{maxchild}=="0" SYSFS{product}=="USB Flash Disk" SYSFS{serial}=="0256" SYSFS{speed}=="480" SYSFS{version}==" 2.00" Here you learn about sysfs attributes to ignore the whole device. With udevinfo -q all -a -p ~+/1-7:1.0 (the actual digits will be different), you get other attributes that might help to select your device. Another sysfs node of interest is even deeper, host*/target*/*:0* or so, where one can query the model. If you can identify your culprit node under /sys/devices/, you will probably be able to prevent its device creation. HTH, Joachim -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Joachim Schrod Email: jschrod@acm.org Roedermark, Germany -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Joachim Schrod さんは書きました: | j debert wrote: |> |> PNY Attache 1Gb flash stick: |> ~ ID 0930:6540 Toshiba Corp |> ~ This is the main flash disk part.. It cannot be mounted when the |> ~ "U3 SMART" partition is mounted. |> ~ usb-0930_USB_Flash_Memory_0F10CB6881E1992A-0:0 |> ~ usb-0930_USB_Flash_Memory_0F10CB6881E1992A-0:0-part1 |> |> ~ The "U3 SMART" media part of the flash drive. Windoze autoruns |> ~ this ISO partition to use the flash device. |> ~ usb-0930_USB_Flash_Memory_0F10CB6881E1992A-0:1 |> |> This last device is the one to be blacklisted. | > | > How can I blacklist the device using the ID so it is never mounted? | | Basically, you need to place a udev rule in /etc/udev/rules.d that looks | like | | SUBSYSTEM=="usb", SYSFS{XYZ}== OPTIONS="ignore_device" | | You need to look for a sysfs attribute that identiefies your U3 media | part. I can't tell from your email what could be used here. | Your best bet is: Identify with lsusb the bus/device number. cd to | /sys/class/usb_device/usbdev<bus>.<device>/device. This was a symlink, | cd to its real dir: cd `/bin/pwd`. Call | udevinfo -q all -a -p ~+ | ~ (snip) That's useful info. So this will reduce some overhead if I can get it to work, especially if it can work for all U3 software media. Thanks! == ~ jd What good is having someone who can walk on water if you don't follow in his footsteps? - -- -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) iD8DBQFJLb70hpL3F+HeDrIRAqgjAKCTkKo8h2QR+u/of7ZO5mowTpxwSwCbBOSg yJl5lVI1P1mjUcG9BD/FA94= =1xDT -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (2)
-
j debert
-
Joachim Schrod