wulf7 / iichid

Generic HID layer for FreeBSD. Including I2C and USB backends.
BSD 2-Clause "Simplified" License
45 stars 6 forks source link

Add driver for generic HID joysticks/gamepads #26

Closed valpackett closed 4 years ago

valpackett commented 4 years ago

Tested on an off-brand cheap USB gamepad with <16 buttons :D but I'm relatively confident in the lots-of-buttons (BTN_TRIGGER_HAPPY) support code.

The list of individual buttons in struct hmap_item[] sucks, would be nice to have a .usage_mask instead of .usage that would allow me to match all HUP_BUTTONs…

wulf7 commented 4 years ago

Thanks for hgame driver.

Could you rework it without using callbacks? Although currently callbacks look better, there are plans to implement HID usage ranges and scatter-gather maps for such a drivers

valpackett commented 4 years ago
wulf7 commented 4 years ago

Merged, thanx

that required a new callback though hence somewhat ugly callback

Callbacks were added for things like this one, They should be used if translation can not be written in declarative way.

currently matching by vendor (Microsoft), would be nice to somehow use the USB_IFACE_SUBCLASS(UISUBCLASS_XBOX360_CONTROLLER) knowledge from usbhid instead

May be create hgame.h with required constants?

valpackett commented 4 years ago

May be create hgame.h with required constants?

I mean how would I pass the info between drivers.. I guess via hid_device_info, which is passed as ivars

wulf7 commented 4 years ago

Yes, hid_device_info is intended to pass information between layers. Do you want place quirks here too?

valpackett commented 4 years ago

Yeah, I guess. (I specifically need to pass a USB-level match to a HID driver)

wulf7 commented 4 years ago

Other way is a global function that compares hid_device_info structure with the predefined quirk list. That is what USB's usb_test_quirk (and usb_quirk(4)) do. But I never dug in to it so I do not know if it can replace passing quirks between drivers.