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

Including Keyboard.h in external projects requires to define hidapi or libusb #282

Open
Dansuf opened this issue Jan 27, 2022 · 0 comments

Comments

@Dansuf
Copy link

Dansuf commented Jan 27, 2022

The README mentions that it's possible to use the g810-led library in other projects by including the Keyboard.h file and linking the g810-led library. However, I noticed that the Keyboard.h file contains some #if defined(...) instructions which need to define either hidapi or libusb. These instructions are used to add library-specific fields to the LedKeyboard class. Without defining neither of the constants, the program allocates too little memory for LedKeyboard objects and this leads to buffer overflows.

Requiring to define one of the usb libraries is also not good, because when dynamically linking, it requires that the g810-led library installed on the system was compiled with the same usb library. I think the solution should be to hide this dependency from headers that are available externally, so that other projects linking against the g810-led library can work with whatever variant of g810-led is installed on the system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant