Now we have our own pid 0x5020 under the vendor id 0x1209, which is

registered under https://pid.codes/1209/5020/
This commit is contained in:
Johannes Leupolz 2025-12-06 20:23:03 +00:00
parent 5b15b6c443
commit a42ef21748
4 changed files with 28 additions and 12 deletions

View file

@ -396,6 +396,19 @@ When mapping 32-bit compat input_event formats into 64-bit representation, copy
**Single-threaded CUSE in foreground mode**
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.
---
## 3.9 Overriding the type, vendor id, and product id
During the creation of the device, the type, vendor id, and product id will be
- type: BUS_USB 0x3
- vendor id: 0x1209,
- product id: 0x5020.
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.
---
## 4. Security Considerations

View file

@ -6,7 +6,7 @@ use std::collections::HashMap;
use std::mem;
use std::os::fd::{AsRawFd, OwnedFd};
use std::io::{Cursor, IoSlice};
use std::io::{IoSlice};
use log::debug;
use nix::sys::socket::{
@ -174,12 +174,12 @@ UDEV [16427452.069342] add /devices/virtual/input/input97 (input)
ACTION=add
DEVPATH=/devices/virtual/input/input97
SUBSYSTEM=input
PRODUCT=3/beef/dead/0
PRODUCT=3/1209/5020/0
NAME="Example device"
PROP=0
EV=3
KEY=ffffffefffff fffffffffffffffe
MODALIAS=input:b0003vBEEFpDEADe0000-e0,1,kramlsfw
MODALIAS=input:b0003v1209p5020e0000-e0,1,kramlsfw
SEQNUM=14498
USEC_INITIALIZED=16427452066918
ID_VUINPUT_KEYBOARD=1

View file

@ -254,8 +254,9 @@ unsafe extern "C" fn vuinput_write(
let mut usetup: uinput_setup = unsafe { std::mem::zeroed() };
usetup.id.bustype = BUS_USB;
usetup.id.vendor = 0xbeef;
usetup.id.product = 0xdead;
// The pid is registered for vuinputd, see https://pid.codes/1209/5020/
usetup.id.vendor = 0x1209;
usetup.id.product = 0x5020;
usetup.id.version = (*legacy_uinput_user_dev).id.version;
usetup.ff_effects_max=(*legacy_uinput_user_dev).ff_effects_max;
usetup.name=(*legacy_uinput_user_dev).name;
@ -556,8 +557,9 @@ unsafe extern "C" fn vuinput_ioctl(
(*setup_ptr).id.vendor
);
// replace vendor and product id to the values from sunshine (see inputtino_common.h of sunshine)
(*setup_ptr).id.product = 0xdead;
(*setup_ptr).id.vendor = 0xbeef;
// The pid is registered for vuinputd, see https://pid.codes/1209/5020/
(*setup_ptr).id.product = 0x5020;
(*setup_ptr).id.vendor = 0x1209;
ui_dev_setup(fd, setup_ptr).unwrap();
fuse_lowlevel::fuse_reply_ioctl(_req, 0, std::ptr::null(), 0);
}

View file

@ -1,9 +1,10 @@
# ===========================================================
# Custom HWDB entry for BEEF:DEAD virtual devices
# Custom HWDB entry for 1209:5020 virtual devices
# -----------------------------------------------------------
# Purpose:
# This entry targets the virtual devices created via uinput
# with vendor_id=0xBEEF and product_id=0xDEAD.
# with vendor_id=0x1209 and product_id=0x5020 of bus type USB (0x0003).
# The pid is registered for vuinputd, see https://pid.codes/1209/5020/.
#
# Why HWDB is used:
# - uinput devices are virtual, so ATTRS{idVendor} / ATTRS{idProduct}
@ -25,8 +26,8 @@
# 1. sudo systemd-hwdb update
# ===========================================================
evdev:input:b0003vBEEFpDEADe0000-*
evdev:input:b0003v1209p5020e????-*
ID_VUINPUT=1
input:b0003vBEEFpDEADe0000-*
ID_VUINPUT=1
input:b0003v1209p5020e????-*
ID_VUINPUT=1