Skip to content

Commit e2ec6dd

Browse files
committed
Fix udev and dumb time crate issue
1 parent 19d9930 commit e2ec6dd

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commands/udev.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
```\nsudo 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

4042
fn 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\"\nSUBSYSTEM==\"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-
"\nSUBSYSTEM==\"input\", ATTRS{{idVendor}}==\"{id_vendor:X}\", ATTRS{{idProduct}}==\"{id_product:X}\""
50-
).unwrap();
53+
"\nSUBSYSTEM==\"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

Comments
 (0)