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

adding additional media keys? #3

Open
msmithkey opened this issue Oct 21, 2019 · 4 comments
Open

adding additional media keys? #3

msmithkey opened this issue Oct 21, 2019 · 4 comments

Comments

@msmithkey
Copy link

Just found your project after beating my head against the wall trying to learn the ESP-IDF. This is the only project I have found that seems to do security in a way where iOS will accept inputs and I have set up a simple program to send single characters with pushbuttons and it works great. thanks for the hard work. One little annoyance of iOS and bluetooth keyboards is that they hide the on screen keyboard whenever a bluetooth keyboard is connected. I am trying to make an ebook page turner remote for a relative who has limited mobility and would like to read on her phone on a gooseneck mount while in bed. In order to toggle the OSK when a BT keyboard is connected, i need have the BT device send the eject key. I have done this in the past using the HID-project.h library
I can't remeber which one worked but it was either
HID_CONSUMER_EJECT
or
HID_CONSUMER_STOP_SLASH_EJECT
I am very new to C and kind of out of my depth in trying to implement this and was hoping someone could point me in the right direction. Thanks again for the great project. I am already dreaming up a way to augment the lack of a physical play/pause button in my honda when using carplay and other interesting little projects.

@T-vK
Copy link
Owner

T-vK commented Oct 21, 2019

You could try to replace

USAGE(1), 0xE2, // USAGE (Mute) ; bit 4: 16

with

  USAGE(1),           0xB8,          //   USAGE (Eject)                ; bit 4: 16

And also replace

const MediaKeyReport KEY_MEDIA_MUTE = {16, 0};

with

const MediaKeyReport KEY_MEDIA_EJECT = {16, 0};

Then you should be able to use:

bleKeyboard.write(KEY_MEDIA_EJECT);

If you think your project could help other people, consider creating a repository for it here on GitHub.

@msmithkey
Copy link
Author

Awesome thanks! will do. I will test this out when i get home tonight. I'm planning on open sourcing it, even though it will be pretty simplistic. Right now I'm just doing proof of concepts and learning new platforms. Appreciate the help

@DhruvGupta5
Copy link

KEY_MEDIA_EJECT

Hi i have two questions

You could try to replace

USAGE(1), 0xE2, // USAGE (Mute) ; bit 4: 16

with

  USAGE(1),           0xB8,          //   USAGE (Eject)                ; bit 4: 16

And also replace

const MediaKeyReport KEY_MEDIA_MUTE = {16, 0};

with

const MediaKeyReport KEY_MEDIA_EJECT = {16, 0};

Then you should be able to use:

bleKeyboard.write(KEY_MEDIA_EJECT);

If you think your project could help other people, consider creating a repository for it here on GitHub.

hi i am new to cpp,
can you kindly answer my two questions

  1. whats the role of bit in the following line ?
    USAGE(1), 0xE2, // USAGE (Mute) ; bit 4: 16 (copied from
    const MediaKeyReport KEY_MEDIA_MUTE = {16, 0};
    )
  2. in reference to the value of HID_CONSUMER_EJECT = 0xB8 from
    https://github.com/NicoHood/HID/blob/d4938ddcff7970bc1d32a040a08afeac4915e4a9/src/HID-APIs/ConsumerAPI.h#L154
    do we still have to use KEY_MEDIA_EJECT for this library ?

@T-vK T-vK pinned this issue Sep 27, 2021
@paulruvolo
Copy link

I tested T-vK's suggested modification to support the eject key, and it works! The only caveat (and maybe this is obvious to others) is that you should unpair with the keyboard and then repair to make sure the device you are connecting to is using the new mapping.

codemaster010 added a commit to codemaster010/ESP32-BLE-Keyboard that referenced this issue Sep 20, 2024
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