Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent usbhid from autoloading when USB HID device is plugged in

I'm trying to (reversibly) disable USB HID support on a Raspbian Jessie install, kernel version 4.4.16-v7+. We need to have the Raspberry Pi in a semi-public space and display stuff on a TV, and we'd like to make it at least somewhat hard to mess with it.

So far I've managed to make the usbhid module removable from the kernel via rmmod. After rmmod'ing the module, tt seems, though, that each time I plug in a USB keyboard or mouse, the device driver gets loaded back into the Kernel.

Is there any way to prevent that?

like image 562
1flx Avatar asked Aug 05 '16 09:08

1flx


1 Answers

udev is the best and easiest way doing that, add a new rule in e.g.: /etc/udev/rules.d/99-disable-usb-hid.rules:

SUBSYSTEMS=="usb", DRIVERS=="usbhid", ACTION=="add", ATTR{authorized}="0"

and restart udev. I've just tested it in Debian Jessie ARM 4.4.16.

like image 69
Sergey Manucharian Avatar answered Sep 24 '22 02:09

Sergey Manucharian