User Tools

Site Tools


bsd:notes:joystick

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
bsd:notes:joystick [2024/09/11 15:47] Sean Rhonebsd:notes:joystick [2025/04/01 03:52] (current) Sean Rhone
Line 5: Line 5:
  
   * :!: Joysticks on FreeBSD need to be at ''/dev/uhid#'' ((''flightgear'', ''neverball'', seemingly ''doomsday'' but it freezes on launch))   * :!: Joysticks on FreeBSD need to be at ''/dev/uhid#'' ((''flightgear'', ''neverball'', seemingly ''doomsday'' but it freezes on launch))
-  * ''uhidd'' by-default does ''/dev/uvhid#'', that can be symlinked to ''/dev/uhid#'' or be done automatically with ''uhidd -H uhid'' +  * ''uhidd'' by-default does ''/dev/uvhid#'', that can be symlinked to ''/dev/uhid#'' or be done automatically with ''uhidd -H uhid'' ((it assigns a specific ''uhid#'' automatically)) 
-  * ''uhidd'' has a lot of flags in examples for keyboard/mouse/consumer, but a joystick only needs the virtual generic interface with ''uhidd -h'' +  * ''uhidd'' has a lot of flags in examples for keyboard/mouse/consumer, but a joystick only needs the virtual generic interface with ''uhidd -h'' (not all of ''-kmohs'') 
-  * ''uhidd'' has to unbind whatever is on the joystick with ''uhidd -u'' +  * ''uhidd'' has to unbind whatever kernel driver is on the joystick with ''uhidd -u'' to take it over 
-  * :?: Seemingly once ''uhidd'' takes control of the original ''/dev/input/event#'' device, if it had ''evdev'' or ''joystick'' forced through ''xorg.conf'' that driver gets unloaded according to ''Xorg.0.log''+  * :?: Seemingly once ''uhidd'' takes control of the original ''/dev/input/event#'' device, if it had ''evdev'' or ''joystick'' forced through ''xorg.conf'' that driver gets unloaded according to ''Xorg.0.log'' ((it sounds like causing ''evdev'' to re-probe on the newly-created ''uhid#'' device could work? there's a ''cdev'' mention with ''devd -d'', but FlightGear shows buttons fine without joystick/evdev binding?))
   * USB devices are by-default put into ''/dev/uhid#'' paths with older [[https://man.freebsd.org/cgi/man.cgi?query=uhid&sektion=4&apropos=0&manpath=FreeBSD+14.1-RELEASE+and+Ports|uhid]] and [[https://man.freebsd.org/cgi/man.cgi?query=usb&sektion=4&apropos=0&manpath=FreeBSD+14.1-RELEASE+and+Ports|usb]] drivers ((using these older drivers prevents USB multimedia keys from working and presumably would require ''uhidd'' to solve; hence use the newer ''usbhid'' driver with ''hw.usb.usbhid.enable="1"'' and ''uhidd'' as-needed on game controllers))   * USB devices are by-default put into ''/dev/uhid#'' paths with older [[https://man.freebsd.org/cgi/man.cgi?query=uhid&sektion=4&apropos=0&manpath=FreeBSD+14.1-RELEASE+and+Ports|uhid]] and [[https://man.freebsd.org/cgi/man.cgi?query=usb&sektion=4&apropos=0&manpath=FreeBSD+14.1-RELEASE+and+Ports|usb]] drivers ((using these older drivers prevents USB multimedia keys from working and presumably would require ''uhidd'' to solve; hence use the newer ''usbhid'' driver with ''hw.usb.usbhid.enable="1"'' and ''uhidd'' as-needed on game controllers))
  
   * 2024/09/09: ''uhidd'' is required to move game controllers to ''/dev/uhid#'' when using [[https://man.freebsd.org/cgi/man.cgi?query=usbhid&sektion=4&format=html|usbhid]]   * 2024/09/09: ''uhidd'' is required to move game controllers to ''/dev/uhid#'' when using [[https://man.freebsd.org/cgi/man.cgi?query=usbhid&sektion=4&format=html|usbhid]]
-  * 2024/09/11: TODO: Test ''webcamd'' with ''usbhid'' https://man.freebsd.org/cgi/man.cgi?query=webcamd&sektion=8&format=html 
  
 ===== uhidd ===== ===== uhidd =====
Line 22: Line 21:
   su -   su -
  
-  pkg install uhidd+  pkg install 'uhidd
 + 
 +  dmesg | grep 'ugen'
  
   uhidd -h -H 'uhid' -u '/dev/ugen0.6'   uhidd -h -H 'uhid' -u '/dev/ugen0.6'
Line 28: Line 29:
 ====== devd.conf ====== ====== devd.conf ======
  
-  * TODO: Figure out if ''ugen'' match is required (works fine without it but might be safer for USB stacks newer than ''usbhid'' doing the unexpected) ([[https://forums.freebsd.org/threads/usb-joystick-with-flightgear.94855/#post-671138|thread]]) +  * Last updated: 2024/09/13
-  * :?: 2024/09/10: Pretty sure logs mentioned something about ''LIBCUSE'' not loading (rule still works) TODO: Remove ''LD_PRELOAD'' and test+
  
   su -   su -
  
-  pkg install uhidd+  pkg install 'uhidd'
  
-  ee '/usr/local/etc/devd/sidewinder-joystick-uhidd.conf'+  ee '/usr/local/etc/devd/sidewinder-precision-pro-joystick-uhidd.conf'
  
 <code> <code>
Line 43: Line 43:
         match "vendor" "0x045e";         match "vendor" "0x045e";
         match "product" "0x0008";         match "product" "0x0008";
-        action "env LD_PRELOAD=/usr/lib/libcuse.so /usr/local/sbin/uhidd -h -H uhid -u /dev/$ugen";+        action "/usr/local/sbin/uhidd -h -H uhid -u /dev/$ugen";
 };</code> };</code>
 +
 +===== TODO =====
 +
 +  * ''ld-elf.so.1 %LIBCUSE%'' error ([[https://forums.freebsd.org/threads/ld-elf-so-1-shared-object-libcuse-not-found.86293/|thread]])
 +
 +  su -l
 +
 +  mv '/usr/local/etc/devd/uhidd-devd.conf' '/usr/local/etc/devd/uhidd-devd.conf~'
 +
 +===== TODO 2 =====
 +
 +  * This avoids needing ''uhidd'' (connect joystick within 3 seconds)
 +  * TODO: USB device reset command and devd
 +
 +  su - root -c "sysctl 'hw.usb.usbhid.enable=0' && sleep '3' && sysctl 'hw.usb.usbhid.enable=1'"
 +
 +==== Solo Key ====
 +
 +****
 +
 +  su - root -c "sysctl 'hw.usb.usbhid.enable=0' && sleep '3' && sysctl 'hw.usb.usbhid.enable=1' && chmod '060' '/dev/uhid0'"
  
/srv/www/wiki/data/attic/bsd/notes/joystick.1726084058.txt.gz · Last modified: by Sean Rhone