hidapi icon indicating copy to clipboard operation
hidapi copied to clipboard

hid_enumerate prints usage of all devices

Open Mola19 opened this issue 2 years ago • 2 comments

This might be user error by me, or maybe it is already solved, but i couldn't find a similar issue.

My code is

#include <iostream>

#include "hidapi.h"

int main()
{
    hid_enumerate(0, 0);
    std::cout << "---END---" << std::endl;
}

Output:

  ---END---
6
6
1
6
1
80
1
1
1
1
92
6
1
6
2
2
1
6
E
1
1
1
6
A1
80
5
80
1
1
1
A1
1
1

The numbers seem to be the usage for each hid device.

The weird thing is that they are printed after the code ends.

Whether hid_init(), hid_exit() or hid_free_enumeration() get called doesn't influence this issue.

OS: Windows 10 Compiler: MSVC C++ 17 HIDAPI version: I reproduced this on 0.14.0, 0.11.0 and 0.9.0

Mola19 avatar Sep 26 '23 17:09 Mola19

very interesting winapi backend doesn't even have the printf anywhere is the behavior changes if you you printf instead of cout?

Youw avatar Sep 26 '23 20:09 Youw

No, it doesn't seem to change anything, neither does removing it

Mola19 avatar Sep 26 '23 21:09 Mola19