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

HID Send? #747

Closed
IBNobody opened this issue Sep 12, 2016 · 7 comments
Closed

HID Send? #747

IBNobody opened this issue Sep 12, 2016 · 7 comments

Comments

@IBNobody
Copy link
Contributor

I am working on a way to send HID messages to AutoHotkey. (See this post...) It is the same principle as hid_listen.

Have we implemented a way to receive data via the HID console and change keyboard parameters such as layers?

@iFreilicht
Copy link
Contributor

I am not aware such a mechanism even exists in the HID specification in the first place. Hid_send is implemented through reserved parts of the HID usage tables. If you find a document where sending data to an HID is documented, I'd love to know about it.

@skullydazed
Copy link
Member

We've been discussing some features that will help with that in #692.

@IBNobody
Copy link
Contributor Author

@iFreilicht

It appears as a vendor defined usage page for PJRC. So, not part of the HID spec, but not in undefined waters.

@IBNobody
Copy link
Contributor Author

FYI: The larger usecase for my AHK system is that I want to be able to enable keyboard specific AHK hotkeys. One of the problems with AHK is that it cannot distinguish between keypresses on separate keyboards by default. There are libs that let you detect by device (AHKHID), but they do not prevent you from masking off a key on a specific keyboard. QMK and RawHID are a solution.

Here is the flow I see.

  1. AHK listens to the PJRC HID channel for multiple devices.
  2. I press a key on a QMK keyboard.
  3. QMK recognizes that the keypress is associated with a QMK macro and fires off the associated keydown macro.
  4. The QMK macro sends a character sequence via the PJRC HID channel.
  5. AHK detects the character sequence coming from a specific device.
  6. AHK fires off a macro tied specifically to keyboard's PJRC HID channel.

Things will get a little tricky if each keyboard has the same PID, though. AHK will know that there are two QMK devices, but it would not be able to tell them apart. Either I will have to use separate PIDs, or I will have to figure out a handshake method to get the keyboards to self-identify. Hence the need for two-way communication.

@drelephant
Copy link

drelephant commented Sep 13, 2016

Well I suppose if you can get two-way communication working, you could send some kind of identifier with each message to identify each individual keyboard.

You could send a command from the PC to set an identifier in eeprom on the keyboard or even a randomly-generated one would be better than no identifier at all.

This doesn't answer how you'd technically achieve the communication channel, but just throwing some ideas out here.

@IBNobody
Copy link
Contributor Author

@drelephant

Hmm... Though I have something semi-random now. Apparently the AVR USB chips we use have a serial number that is readable. I have never used it, but maybe that is something I can base things on?

By the way, the two way comm channel is already available. https://www.pjrc.com/teensy/rawhid.html

What is missing is support in QMK to do the reading (currently commented out) and then do anything with the data read.

@skullydazed
Copy link
Member

Closing this in favor of discussion on #692, #895, and a possible future qmk implementation of https://github.com/hid-io/hid-io/tree/master/spec.

bdjohnson79 pushed a commit to bdjohnson79/qmk_firmware that referenced this issue Oct 15, 2024
* GMMK V2 96 ISO

* Update keyboards/gmmk/gmmk2/p96/iso/keymaps/vial/vial.json

Co-authored-by: adophoxia <[email protected]>

* Update keyboards/gmmk/gmmk2/p96/iso/keymaps/vial/config.h

Co-authored-by: adophoxia <[email protected]>

* LTO_ENABLE seems to be not needed

---------

Co-authored-by: adophoxia <[email protected]>
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

4 participants