Хочу реализовать белый список USB устройств через udev.
Примерно вот такое:
SUBSYSTEM=="usb", ATTR{idVendor}=="", ATTR{idProduct}=="", GOTO="AUTH"
SUBSYSTEM=="usb", ATTR{idVendor}=="", ATTR{idProduct}=="", GOTO="AUTH"
SUBSYSTEM=="usb", ATTR{idVendor}=="", ATTR{idProduct}=="", GOTO="AUTH"
SUBSYSTEM=="usb", ATTR{idVendor}=="", ATTR{idProduct}=="", GOTO="AUTH"
SUBSYSTEM=="usb", ATTR{idVendor}=="", ATTR{idProduct}=="", GOTO="AUTH"
ATTR{authorized}="0",
GOTO="END"
LABEL="AUTH"
ATTR{authorized}="1"
LABEL="END"
Начал со списка из одного элемента (клавиатуры)
SUBSYSTEM=="usb", ATTR{idVendor}=="1c4f", ATTR{idProduct}=="0002", GOTO="AUTH"
ATTR{authorized}="0",
GOTO="END"
LABEL="AUTH"
ATTR{authorized}="1"
LABEL="END"
в lsusb она выглядит вот так (спойлер):
Bus 004 Device 002: ID 1c4f:0002 SiGma Micro Keyboard TRACER Gamma Ivory
Bus 004 Device 015: ID 1c4f:0002 SiGma Micro Keyboard TRACER Gamma Ivory
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 [unknown]
bDeviceSubClass 0 [unknown]
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x1c4f SiGma Micro
idProduct 0x0002 Keyboard TRACER Gamma Ivory
bcdDevice 1.10
iManufacturer 1 SEM
iProduct 2 HCT Keyboard
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x003b
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 98mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 54
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 10
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 [unknown]
bInterfaceProtocol 0
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 50
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 10
Device Status: 0x0000
(Bus Powered)
после применения такого правила никакие USB устройства не работают (в том числе и клавиатура)