Taking iconv out of the equation for now (problems with converting UTF-16LE?), I now get,
H:\tmp\hidapi\lib>hidtest.exe
hidapi test/example tool. Compiled with hidapi version 0.11.0, runtime version 0.11.0.
Compile-time version matches runtime version of hidapi.
make_path() failed. unknown error
make_path() failed. unknown error
make_path() failed. unknown error
Device Found
type: 046d c534
path:
serial_number: (null)
Manufacturer: Logitech
Product: USB Receiver
Release: 2901
Interface: 0
Usage (page): 0x6 (0x1)
Device Found
type: 046d c534
path:
serial_number: (null)
Manufacturer: Logitech Product: USB Receiver Release: 2901
Interface: 1
Usage (page): 0x6 (0x1)
Device Found
type: 046d c216
path:
serial_number: (null)
Manufacturer: Logitech Product: Logitech Dual Action Release: 300
Interface: 0
Usage (page): 0x4 (0x1)
unable to open device
Better but there is still the make_path() error.
Looking at the code, it seems that libusb screws up returning the number of ports,
static char *make_path(libusb_device *dev, int interface_number, int config_number)
{
char str[64]; /* max length "000-000.000.000.000.000.000.000:000.000" */
/* Note that USB3 port count limit is 7; use 8 here for alignment */
uint8_t port_numbers[8] = {0, 0, 0, 0, 0, 0, 0, 0};
int num_ports = libusb_get_port_numbers(dev, port_numbers, 8);
if (num_ports > 0) {
int n = snprintf(str, sizeof("000-000"), "%u-%u", libusb_get_bus_number(dev), port_numbers[0]);
for (uint8_t i = 1; i < num_ports; i++) {
n += snprintf(&str[n], sizeof(".000"), ".%u", port_numbers[i]);
}
n += snprintf(&str[n], sizeof(":000.000"), ":%u.%u", (uint8_t)config_number, (uint8_t)interface_number);
str[n] = '\0';
} else {
/* USB3.0 specs limit number of ports to 7 and buffer size here is 8 */
if (num_ports == LIBUSB_ERROR_OVERFLOW) {
LOG("make_path() failed. buffer overflow error\n");
} else {
LOG("make_path() failed. unknown error\n");
}
str[0] = '\0';
}
return strdup(str);
}
Or maybe something else? There's also the null serial number, problem with UTF-16?