From a42ef217489d44b8dce0147f4dc5a81ca229a26a Mon Sep 17 00:00:00 2001 From: Johannes Leupolz Date: Sat, 6 Dec 2025 20:23:03 +0000 Subject: [PATCH] Now we have our own pid 0x5020 under the vendor id 0x1209, which is registered under https://pid.codes/1209/5020/ --- docs/DESIGN.md | 13 +++++++++++++ vuinputd/src/container/netlink_message.rs | 6 +++--- vuinputd/src/main.rs | 10 ++++++---- vuinputd/udev/90-vuinputd.hwdb | 11 ++++++----- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/docs/DESIGN.md b/docs/DESIGN.md index 4035d7f..166e29c 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -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 diff --git a/vuinputd/src/container/netlink_message.rs b/vuinputd/src/container/netlink_message.rs index eb2a16b..8deb8de 100644 --- a/vuinputd/src/container/netlink_message.rs +++ b/vuinputd/src/container/netlink_message.rs @@ -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 diff --git a/vuinputd/src/main.rs b/vuinputd/src/main.rs index 7ea18a3..6f8ceed 100644 --- a/vuinputd/src/main.rs +++ b/vuinputd/src/main.rs @@ -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); } diff --git a/vuinputd/udev/90-vuinputd.hwdb b/vuinputd/udev/90-vuinputd.hwdb index 6992951..0a580ed 100644 --- a/vuinputd/udev/90-vuinputd.hwdb +++ b/vuinputd/udev/90-vuinputd.hwdb @@ -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 \ No newline at end of file