@@ -23,8 +23,10 @@ pub async fn generate_udev(
2323 let attachment = CreateAttachment :: bytes ( udev, "70-opentabletdriver.rules" ) ;
2424 ctx. send (
2525 CreateReply :: default ( )
26- . content ( "place this file in `/etc/udev/rules.d/70-opentabletdriver.rules` then run the following:\n \
27- ```\n sudo udevadm control --reload-rules && sudo udevadm trigger\n ```")
26+ . content (
27+ "place this file in `/etc/udev/rules.d/70-opentabletdriver.rules` then run the \
28+ following: \n ```sudo udevadm control --reload-rules && sudo udevadm trigger\n ```",
29+ )
2830 . attachment ( attachment) ,
2931 )
3032 . await ?;
@@ -39,15 +41,19 @@ KERNEL=="js[0-9]*", SUBSYSTEM=="input", ATTRS{name}=="OpenTabletDriver Virtual T
3941
4042fn gen_udev ( id_vendor : u64 , id_product : u64 , libinput_override : bool ) -> String {
4143 let mut udev_rules = format ! (
42- "KERNEL==\" hidraw*\" , ATTRS{{idVendor}}==\" {id_vendor:X}\" , ATTRS{{idProduct}}==\" {id_product:X}\" , TAG+=\" uaccess\" , TAG+=\" udev-acl\" \n \
43- SUBSYSTEM==\" usb\" , ATTRS{{idVendor}}==\" {id_vendor:X}\" , ATTRS{{idProduct}}==\" {id_product:X}\" , TAG+=\" uaccess\" , TAG+=\" udev-acl\" "
44+ "KERNEL==\" hidraw*\" , ATTRS{{idVendor}}==\" {id_vendor:04x}\" , \
45+ ATTRS{{idProduct}}==\" {id_product:04x}\" , TAG+=\" uaccess\" , \
46+ TAG+=\" udev-acl\" \n SUBSYSTEM==\" usb\" , ATTRS{{idVendor}}==\" {id_vendor:04x}\" , \
47+ ATTRS{{idProduct}}==\" {id_product:04x}\" , TAG+=\" uaccess\" , TAG+=\" udev-acl\" "
4448 ) ;
4549
4650 if libinput_override {
4751 write ! (
4852 udev_rules,
49- "\n SUBSYSTEM==\" input\" , ATTRS{{idVendor}}==\" {id_vendor:X}\" , ATTRS{{idProduct}}==\" {id_product:X}\" "
50- ) . unwrap ( ) ;
53+ "\n SUBSYSTEM==\" input\" , ATTRS{{idVendor}}==\" {id_vendor:04x}\" , \
54+ ATTRS{{idProduct}}==\" {id_product:04x}\" , ENV{{LIBINPUT_IGNORE_DEVICE}}=\" 1\" "
55+ )
56+ . unwrap ( ) ;
5157 }
5258
5359 format ! ( "{REQUIRED_UDEV_STR}\n # Generated by TabletBot\n {udev_rules}" )
0 commit comments