Skip to content

hid_enumerate with hidraw backend returns lots of duplicate hid_device_infos #298

Closed
@Be-ing

Description

@Be-ing

Calling hid_enumerate with the hidraw Linux backend returns lots of duplicate hid_device_infos for the same device. I have to filter out duplicates by comparing the paths of the devices: https://github.com/mixxxdj/mixxx/pull/4054/files/6dd77b1fa61a2101e2dfac7cb7af85bf5eab168b#r663541357

Activity

Youw

Youw commented on Jul 4, 2021

@Youw
Member

Do those devices have the same usage/usage_page pairs? Have you tried the same device on Windows?

added
hidrawRelated to Linux/hidraw backend
on Jul 4, 2021
Be-ing

Be-ing commented on Jul 5, 2021

@Be-ing
ContributorAuthor

Some do, some do not. Here is the output from Mixxx:

info [Controller] Scanning USB HID devices
info [Controller] Found HID device: { 17cc:1720 r60 | Usage: ff01:0000 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:0001 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:0001 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:0030 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:0001 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:0030 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:0030 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:0030 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:0080 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:0080 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:0080 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:0080 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:00d8 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:00d8 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:00f0 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:00f0 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:00e0 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Duplicate HID device, excluding { 17cc:1720 r60 | Usage: ff01:00e0 | Interface: #3 | Manufacturer: Native Instruments | Product: Traktor Kontrol S4 MK3 | S/N: 69DDA7A8 }
info [Controller] Found HID device: { 056a:5110 r0 | Usage: 000d:0004 | Product: WCOM5110:00 056A:5110 }
info [Controller] Duplicate HID device, excluding { 056a:5110 r0 | Usage: 000d:0022 | Product: WCOM5110:00 056A:5110 }
info [Controller] Duplicate HID device, excluding { 056a:5110 r0 | Usage: 000d:0022 | Product: WCOM5110:00 056A:5110 }
info [Controller] Duplicate HID device, excluding { 056a:5110 r0 | Usage: 000d:0022 | Product: WCOM5110:00 056A:5110 }
info [Controller] Duplicate HID device, excluding { 056a:5110 r0 | Usage: 000d:0022 | Product: WCOM5110:00 056A:5110 }
info [Controller] Duplicate HID device, excluding { 056a:5110 r0 | Usage: 000d:0022 | Product: WCOM5110:00 056A:5110 }
info [Controller] Duplicate HID device, excluding { 056a:5110 r0 | Usage: ff11:0011 | Product: WCOM5110:00 056A:5110 }
info [Controller] Duplicate HID device, excluding { 056a:5110 r0 | Usage: 000d:000e | Product: WCOM5110:00 056A:5110 }
info [Controller] Duplicate HID device, excluding { 056a:5110 r0 | Usage: 000d:0023 | Product: WCOM5110:00 056A:5110 }
info [Controller] Duplicate HID device, excluding { 056a:5110 r0 | Usage: 000d:0002 | Product: WCOM5110:00 056A:5110 }
info [Controller] Duplicate HID device, excluding { 056a:5110 r0 | Usage: 000d:0020 | Product: WCOM5110:00 056A:5110 }
info [Controller] Duplicate HID device, excluding { 056a:5110 r0 | Usage: ff11:0002 | Product: WCOM5110:00 056A:5110 }
info [Controller] Duplicate HID device, excluding { 056a:5110 r0 | Usage: ff11:0020 | Product: WCOM5110:00 056A:5110 }
info [Controller] Duplicate HID device, excluding { 056a:5110 r0 | Usage: 0001:0002 | Product: WCOM5110:00 056A:5110 }
info [Controller] Duplicate HID device, excluding { 056a:5110 r0 | Usage: 0001:0001 | Product: WCOM5110:00 056A:5110 }
info [Controller] Found HID device: { 06cb:7f8b r0 | Usage: 0001:0002 | Product: SYNA2B31:00 06CB:7F8B }
info [Controller] Duplicate HID device, excluding { 06cb:7f8b r0 | Usage: 0001:0001 | Product: SYNA2B31:00 06CB:7F8B }
info [Controller] Duplicate HID device, excluding { 06cb:7f8b r0 | Usage: 000d:0005 | Product: SYNA2B31:00 06CB:7F8B }
info [Controller] Duplicate HID device, excluding { 06cb:7f8b r0 | Usage: 000d:0022 | Product: SYNA2B31:00 06CB:7F8B }
info [Controller] Duplicate HID device, excluding { 06cb:7f8b r0 | Usage: 000d:0022 | Product: SYNA2B31:00 06CB:7F8B }
info [Controller] Duplicate HID device, excluding { 06cb:7f8b r0 | Usage: 000d:0022 | Product: SYNA2B31:00 06CB:7F8B }
info [Controller] Duplicate HID device, excluding { 06cb:7f8b r0 | Usage: 000d:0022 | Product: SYNA2B31:00 06CB:7F8B }
info [Controller] Duplicate HID device, excluding { 06cb:7f8b r0 | Usage: 000d:0022 | Product: SYNA2B31:00 06CB:7F8B }
info [Controller] Duplicate HID device, excluding { 06cb:7f8b r0 | Usage: 000d:000e | Product: SYNA2B31:00 06CB:7F8B }
info [Controller] Duplicate HID device, excluding { 06cb:7f8b r0 | Usage: 000d:0022 | Product: SYNA2B31:00 06CB:7F8B }
info [Controller] Duplicate HID device, excluding { 06cb:7f8b r0 | Usage: 000d:0022 | Product: SYNA2B31:00 06CB:7F8B }
info [Controller] Duplicate HID device, excluding { 06cb:7f8b r0 | Usage: ff00:0001 | Product: SYNA2B31:00 06CB:7F8B }
info [Controller] Found HID device: { 046d:b020 r0 | Usage: 0001:0002 | Product: MX Vertical | S/N: ed:39:60:f6:c3:e4 }
info [Controller] Duplicate HID device, excluding { 046d:b020 r0 | Usage: 0001:0001 | Product: MX Vertical | S/N: ed:39:60:f6:c3:e4 }
info [Controller] Duplicate HID device, excluding { 046d:b020 r0 | Usage: ff43:0202 | Product: MX Vertical | S/N: ed:39:60:f6:c3:e4 }
Be-ing

Be-ing commented on Jul 5, 2021

@Be-ing
ContributorAuthor

I have not tested these devices on Windows.

Youw

Youw commented on Jul 5, 2021

@Youw
Member

some do not

This is unexpected.

Some do

That is expected. That is the only way to check supported usage/usage_page-s of the device - report same device multiple times with the same path but different usage/usage_page pair

I have not tested these devices on Windows.

I see.

mcuee

mcuee commented on Jul 13, 2021

@mcuee
Member

Interesting, I have not seen such issue under Windows 10 Dell PC and macOS (Mac Mini M1). But I have not done much testing on Linux side (my Raspberry Pi 400 is my Linux computer now).

Be-ing

Be-ing commented on Aug 1, 2021

@Be-ing
ContributorAuthor
mcuee

mcuee commented on Aug 2, 2021

@mcuee
Member

@Be-ing It will be good to post the output of hidtest and the report descriptors (eg: under Linux or macOS). That may give some clues about the devices. Windows will create multiple devices with each for TLC (top level collections) and may even have some virtual device created on top.

Windows: https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/top-level-collections

mcuee

mcuee commented on Aug 2, 2021

@mcuee
Member

@Be-ing It seems that it is not really an issue under Windows to have "multiple individual enabled devices for my singular mouse and keyboard". That is kind of expected under windows with devices with multiple TLCs, same for hidraw and macOS.

Maybe Mixxx code has wrong assumptions in this asepct.

Relevant discussion: #287

Be-ing

Be-ing commented on Aug 2, 2021

@Be-ing
ContributorAuthor

Maybe Mixxx code has wrong assumptions in this asepct.

Perhaps, but besides potential functional implications, there is an issue of user confusion showing the same device multiple times.

mcuee

mcuee commented on Aug 2, 2021

@mcuee
Member

Maybe Mixxx code has wrong assumptions in this asepct.

Perhaps, but besides potential functional implications, there is an issue of user confusion showing the same device multiple times.

That you can not change. hidapi is designed this way. You have to change mixxx.

Be-ing

Be-ing commented on Aug 2, 2021

@Be-ing
ContributorAuthor

I already did: mixxxdj/mixxx@5c58257

But I wasn't sure if the problem was in Mixxx's use of hidapi or in hidapi.

mcuee

mcuee commented on Aug 2, 2021

@mcuee
Member

In order to debug, please post the output of hidapi hidtest and the report descriptors.

mcuee

mcuee commented on Aug 2, 2021

@mcuee
Member

@Be-ing As @Youw mentioned, if the device does not have the "same usage/usage_page pairs", then the behavior is not expected with Linux hidraw backend. Then that could be a hidapi bug. Please post the output of hidtest and the report descriptor to debug the issue with hidraw.

46 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    hidrawRelated to Linux/hidraw backend

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      hid_enumerate with hidraw backend returns lots of duplicate hid_device_infos · Issue #298 · libusb/hidapi