0
\$\begingroup\$

I am currently working on a customized input device. Since the Bluetooth connection from the controller to the PC is not as easy as I thought at first, I decided to use a controller which already comes with a Bluetooth adapter on board.

What I want to do now is add three buttons to it. I know how this is done, but I can't figure out how I tell my PC that these buttons should function like a mouse or keyboard.

I looked for drivers but had no luck yet. Any ideas?

\$\endgroup\$
  • \$\begingroup\$ Keyboards operate on a character map where you press a button and it runs through some type of multiplexing process in a microprocessor. Whatever happens between the keyboard and the computer is determined by the operating system. The OS, say something like Windows for an example, is able to receive that information from the keyboard so that you can execute a command or display a letter on a screen when you hit the key on the keyboard. \$\endgroup\$ – KingDuken Jun 20 '18 at 15:43
  • \$\begingroup\$ You change the drivers, be prepared to spend a solid month or two learning how to write drivers. The first thing would be to look at HID drivers. \$\endgroup\$ – laptop2d Jun 20 '18 at 17:54
0
\$\begingroup\$

That actually depends on your OS. To make it compatible with any OS you have to implement HID device's profile (USB or Bluetooth, does not matter). In case of HID any system (including Android) recognizes your device as mouse or keyboard (depending on HID descriptor you use).

If you want to make OS dependant (but simple) solution without implementing HID then for Windows there are few methods for mouse and keyboard emulation. To position mouse you have to use SetCursorPos() function. So once you press "Left" key onyour device it sends notification to PC and you increment current cursor position and call SetCursorPos() with new one. Same for "Right" button. Mouse click can be emulated by mouse_event() function.

Unfortunately I have no idea how to do that on Linux based OSes.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.