Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for HID over I2C and uhid devices #166

Merged
merged 1 commit into from
Nov 23, 2020

Conversation

haata
Copy link
Contributor

@haata haata commented May 25, 2020

  • uhid USB, Bluetooth (standard) and I2C now enumerating
    • USB uhid support was added by removing the udev USB endpoint check
  • HID over I2C was excluded before (likely because it didn't exist when
    hidraw was developed)

I'm still looking for a device with HID over I2C (I have one
somewhere...). For now I've tested that code path using uhid instead.

Device Found
type: 308f 0030
path: /dev/hidraw14
serial_number: uhid virtual
Manufacturer:
Product: HID-IO Virtual Keyboard - Standard USB
Release: 0
Interface: -1
Usage (page): 0x6 (0x1)

Device Found
type: 308f 0030
path: /dev/hidraw17
serial_number: uhid virtual
Manufacturer:
Product: HID-IO Virtual Keyboard - Standard I2C
Release: 0
Interface: -1
Usage (page): 0x6 (0x1)

Copy link
Member

@Youw Youw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Although, I cannot check or verify any of this.
Would be great if someone could check it just to confirm.

@haata haata force-pushed the uhid_i2c_support branch from a4ed6a2 to e10eeef Compare May 26, 2020 05:33
@haata
Copy link
Contributor Author

haata commented May 26, 2020

I added a few more changes (forgot about the get_device_string function), after I did some more integration testing.

Thanks for reviewing!

If anyone would like to test the uhid part, a very easy way is to build this uhid-virt example https://github.com/haata/uhid-virt/tree/master/example; you'll need to run the executable as root though.

cargo build
sudo target/debug/example

Pressing enter while running will move the mouse.
Ctrl-C to exit.
(it's just a rust version of the Linux kernel uhid example code https://github.com/torvalds/linux/blob/master/samples/uhid/uhid-example.c; but it's a bit easier to setup if you already have rust on your system).

The HID over I2C is a bit trickier unfortunately.

@haata haata force-pushed the uhid_i2c_support branch from e10eeef to c269b93 Compare May 26, 2020 05:54
@haata
Copy link
Contributor Author

haata commented May 26, 2020

Cleaned up code formatting.

linux/hid.c Show resolved Hide resolved
- uhid USB, Bluetooth (standard) and I2C now enumerating
  * USB uhid support was added by removing the udev USB endpoint check
- HID over I2C was excluded before (likely because it didn't exist when
  hidraw was developed)

I'm still looking for a device with HID over I2C (I have one
somewhere...). For now I've tested that code path using uhid instead.

Device Found
  type: 308f 0030
  path: /dev/hidraw14
  serial_number: uhid virtual
  Manufacturer:
  Product:      HID-IO Virtual Keyboard - Standard USB
  Release:      0
  Interface:    -1
  Usage (page): 0x6 (0x1)

Device Found
  type: 308f 0030
  path: /dev/hidraw17
  serial_number: uhid virtual
  Manufacturer:
  Product:      HID-IO Virtual Keyboard - Standard I2C
  Release:      0
  Interface:    -1
  Usage (page): 0x6 (0x1)
@haata haata force-pushed the uhid_i2c_support branch from bc2d10e to 7ae37ae Compare May 26, 2020 15:04
@Youw
Copy link
Member

Youw commented Nov 23, 2020

@haata do you have anything to add to this PR? I think it is ready to be merged

@haata
Copy link
Contributor Author

haata commented Nov 23, 2020

I think everything is still good. I've been running with these changes for quite a while now and haven't had any issues.

@Youw Youw merged commit ffb50af into libusb:master Nov 23, 2020
Youw pushed a commit that referenced this pull request Nov 23, 2020
- uhid USB, Bluetooth (standard) and I2C now enumerating
  * USB uhid support was added by removing the udev USB endpoint check;
- HID over I2C was excluded before (likely because it didn't exist when
  hidraw was developed);
@mcuee mcuee added the hidraw Related to Linux/hidraw backend label Jun 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hidraw Related to Linux/hidraw backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants