Skip to content

Commit a42ef21

Browse files
committed
Now we have our own pid 0x5020 under the vendor id 0x1209, which is
registered under https://pid.codes/1209/5020/
1 parent 5b15b6c commit a42ef21

4 files changed

Lines changed: 28 additions & 12 deletions

File tree

docs/DESIGN.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,19 @@ When mapping 32-bit compat input_event formats into 64-bit representation, copy
396396
**Single-threaded CUSE in foreground mode**
397397

398398
No high volume of events expected where we could benefit from multiple threads. But much of the code is already prepared for multithreading, if there is really demand.
399+
400+
---
401+
402+
## 3.9 Overriding the type, vendor id, and product id
403+
404+
During the creation of the device, the type, vendor id, and product id will be
405+
- type: BUS_USB 0x3
406+
- vendor id: 0x1209,
407+
- product id: 0x5020.
408+
409+
BUS_VIRTUAL 0x6 is not used, because I couldn't find a place where I could register a vendor and product id. The now used combination is unique, as the product id is registered under [pid.codes](https://pid.codes/1209/5020/). So, there is no problem to use it in a system-wide hwdb-file for udev.
410+
411+
399412
---
400413

401414
## 4. Security Considerations

vuinputd/src/container/netlink_message.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::collections::HashMap;
66
use std::mem;
77
use std::os::fd::{AsRawFd, OwnedFd};
88

9-
use std::io::{Cursor, IoSlice};
9+
use std::io::{IoSlice};
1010

1111
use log::debug;
1212
use nix::sys::socket::{
@@ -174,12 +174,12 @@ UDEV [16427452.069342] add /devices/virtual/input/input97 (input)
174174
ACTION=add
175175
DEVPATH=/devices/virtual/input/input97
176176
SUBSYSTEM=input
177-
PRODUCT=3/beef/dead/0
177+
PRODUCT=3/1209/5020/0
178178
NAME="Example device"
179179
PROP=0
180180
EV=3
181181
KEY=ffffffefffff fffffffffffffffe
182-
MODALIAS=input:b0003vBEEFpDEADe0000-e0,1,kramlsfw
182+
MODALIAS=input:b0003v1209p5020e0000-e0,1,kramlsfw
183183
SEQNUM=14498
184184
USEC_INITIALIZED=16427452066918
185185
ID_VUINPUT_KEYBOARD=1

vuinputd/src/main.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,9 @@ unsafe extern "C" fn vuinput_write(
254254

255255
let mut usetup: uinput_setup = unsafe { std::mem::zeroed() };
256256
usetup.id.bustype = BUS_USB;
257-
usetup.id.vendor = 0xbeef;
258-
usetup.id.product = 0xdead;
257+
// The pid is registered for vuinputd, see https://pid.codes/1209/5020/
258+
usetup.id.vendor = 0x1209;
259+
usetup.id.product = 0x5020;
259260
usetup.id.version = (*legacy_uinput_user_dev).id.version;
260261
usetup.ff_effects_max=(*legacy_uinput_user_dev).ff_effects_max;
261262
usetup.name=(*legacy_uinput_user_dev).name;
@@ -556,8 +557,9 @@ unsafe extern "C" fn vuinput_ioctl(
556557
(*setup_ptr).id.vendor
557558
);
558559
// replace vendor and product id to the values from sunshine (see inputtino_common.h of sunshine)
559-
(*setup_ptr).id.product = 0xdead;
560-
(*setup_ptr).id.vendor = 0xbeef;
560+
// The pid is registered for vuinputd, see https://pid.codes/1209/5020/
561+
(*setup_ptr).id.product = 0x5020;
562+
(*setup_ptr).id.vendor = 0x1209;
561563
ui_dev_setup(fd, setup_ptr).unwrap();
562564
fuse_lowlevel::fuse_reply_ioctl(_req, 0, std::ptr::null(), 0);
563565
}

vuinputd/udev/90-vuinputd.hwdb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# ===========================================================
2-
# Custom HWDB entry for BEEF:DEAD virtual devices
2+
# Custom HWDB entry for 1209:5020 virtual devices
33
# -----------------------------------------------------------
44
# Purpose:
55
# This entry targets the virtual devices created via uinput
6-
# with vendor_id=0xBEEF and product_id=0xDEAD.
6+
# with vendor_id=0x1209 and product_id=0x5020 of bus type USB (0x0003).
7+
# The pid is registered for vuinputd, see https://pid.codes/1209/5020/.
78
#
89
# Why HWDB is used:
910
# - uinput devices are virtual, so ATTRS{idVendor} / ATTRS{idProduct}
@@ -25,8 +26,8 @@
2526
# 1. sudo systemd-hwdb update
2627
# ===========================================================
2728

28-
evdev:input:b0003vBEEFpDEADe0000-*
29+
evdev:input:b0003v1209p5020e????-*
2930
ID_VUINPUT=1
3031

31-
input:b0003vBEEFpDEADe0000-*
32-
ID_VUINPUT=1
32+
input:b0003v1209p5020e????-*
33+
ID_VUINPUT=1

0 commit comments

Comments
 (0)