Adding support for HID over I2C and uhid devices #166

Merged
haata merged 1 commit from uhid_i2c_support into master 2020-11-23 13:53:05 -06:00
haata commented 2020-05-25 15:40:20 -05:00 (Migrated from github.com)
  • 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)

- 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)
Youw (Migrated from github.com) approved these changes 2020-05-25 16:27:13 -05:00
Youw (Migrated from github.com) left a comment

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

LGTM Although, I cannot check or verify any of this. Would be great if someone could check it just to confirm.
haata commented 2020-05-26 00:40:44 -05:00 (Migrated from github.com)

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.

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 commented 2020-05-26 00:54:59 -05:00 (Migrated from github.com)

Cleaned up code formatting.

Cleaned up code formatting.
Youw (Migrated from github.com) approved these changes 2020-05-26 07:58:10 -05:00
@ -361,3 +371,4 @@
}
}
}
}
Youw (Migrated from github.com) commented 2020-05-26 07:58:06 -05:00

I just like when things like this are explicit

				}
				else {
					/* Correctly handled below */
				}
I just like when things like this are explicit ```suggestion } else { /* Correctly handled below */ } ```
Youw commented 2020-11-23 13:27:18 -06:00 (Migrated from github.com)

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

@haata do you have anything to add to this PR? I think it is ready to be merged
haata commented 2020-11-23 13:39:09 -06:00 (Migrated from github.com)

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

I think everything is still good. I've been running with these changes for quite a while now and haven't had any issues.
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-libusb/hidapi!166
No description provided.