dom0+vm/qvm-usb: First implementation of udev rules and supporting scripts.
This commit is contained in:
parent
a9fd8ec5dd
commit
e1fc07613d
10
misc/qubes_usb.rules
Normal file
10
misc/qubes_usb.rules
Normal file
@ -0,0 +1,10 @@
|
||||
# Expose all USB devices (except block) via xenstore
|
||||
|
||||
# Handle only USB devices
|
||||
SUBSYSTEM!="usb", GOTO="qubes_usb_end"
|
||||
|
||||
ACTION=="add", IMPORT{program}="/usr/lib/qubes/usb_add_change"
|
||||
ACTION=="change", IMPORT{program}="/usr/lib/qubes/usb_add_change"
|
||||
ACTION=="remove", RUN+="/usr/lib/qubes/usb_remove"
|
||||
|
||||
LABEL="qubes_usb_end"
|
9
misc/usb_add_change
Executable file
9
misc/usb_add_change
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "x$DEVTYPE" = "xusb_device" ] || exit 0
|
||||
|
||||
NAME="${ID_VENDOR_ID}_${ID_MODEL_ID}"
|
||||
DESC="${NAME} ${ID_SERIAL}"
|
||||
XS_KEY="qubes-usb-devices/$NAME"
|
||||
|
||||
xenstore-write "$XS_KEY/desc" "$DESC"
|
10
misc/usb_remove
Executable file
10
misc/usb_remove
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "x$DEVTYPE" = "xusb_device" ] || exit 0
|
||||
|
||||
NAME="${ID_VENDOR_ID}_${ID_MODEL_ID}"
|
||||
DESC="${NAME} ${ID_SERIAL}"
|
||||
XS_KEY="qubes-usb-devices/$NAME"
|
||||
|
||||
xenstore-rm "$XS_KEY"
|
||||
|
Loading…
Reference in New Issue
Block a user