Sorry for reply so late. I'm an intern and I cannot test your
suggestion in the past two days. I didn't fully understand this udev
stuff and your reply, and here is my questions:
a. about ":="
The man page says that the ":=" means that "Assign a value to a key
finally; disallow any later changes, which may be used to prevent
changes by any later rules."
So I think a rule like this:
SUBSYSTEMS=="usb", ACTION=="add", RUN:="/test.sh usb"
will prevent adding more programs to RUN, and finally stop calling any
"modprobe" in /lib/udev/rules.d/80-drivers.rules so that drivers are
not loaded. But the usb devices are still working.
b. The function of steps 2
My environment is a costumed Linux, I cannot find
/lib/modules/$(uname -r) directory...
c. how to identify the device is a usb device.
Just seeing the examples on
http://www.reactivated.net/writing_udev_rules.html, I'm more confused.
Each usb device has a particular match keys. I just want to know
whether this device is connecting to usb ports, and manage it.
If anybody has some hints, please tell me. Thanks!
1. You can tweak udev rules for USB storagedevices.
2. You can explicitely can make your kernel to not load usb storage driver as below
$ ls /lib/modules/$(uname -r)/kernel/drivers/usb/storage/usb-storage.ko
$ mv /lib/modules/$(uname -r)/kernel/drivers/usb/storage/usb-storage.ko /root
Thanks
ASHU
-----Original Message-----
Sent: Tuesday, June 05, 2012 12:33 PM
To: kernelnewbies
Subject: Fwd: How can I disable all USB devices?
Thanks for reply! But it seems not suitable for my job.
Sorry for that I didn't talk about my situation clearly. I was asked to only enable usb Network Interface Card, and disable all other usb devices(like keyboard, mouse, stick, etc.).
I need a way to distinguish different usb devices and disable/enable them. If anyone has some idea, please tell me.
Hi
You can just disable the USB support for your kernel by editing kernel parameters.
Just add "nousb" to you kernel parameters In "/etc/grub.conf" and your kernel should not support USB device thereafter.
Also when you would like to enable them again just remove "nousb" from kernel command line and all should work fine with that.
Please let me know if that helped you.
Ashish Bunkar
Linux Engineering
Dell | BDC
-----Original Message-----
Sent: Tuesday, June 05, 2012 8:48 AM
To: kernelnewbies
Subject: How can I disable all USB devices?
Hi there,
I want to disable all my USB devices (mouse, keyboard,... ) now, but hope to enable some certain device in the future. And I don't want to recompile kernel or disable usb module.
I've searched on the Internet, and it seems that udev manage devices connecting to my computer. Can I use udev to disable all USB devices?
Thanks!
_______________________________________________
Kernelnewbies mailing list
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________
Kernelnewbies mailing list
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies