7

I'm trying to create a virtual bluetooth keyboard client for Mac OS. that means my Mac will serve as a BT KB. I read about the bluetooth API in OS X (in ObjC), and I also found an HID API for Mac (in C)

To make this work I understand I need to declare an hid-keyboard-service that should be broadcasted on SDP queries.

  1. if I declare an HID service using the HID API, is my service visible/broadcasted on Bluetooth too? (the documents seems to refer to HID with regards to USB only). - are HID services visible on both bluetooth and USB interfaces, and the underlaying connection is transparent to me?
  2. is there any code that will help me with this you know about? I prefer ObjC, but it seems HID API is C only... :(

Thanks...!

eyalw
  • 730
  • 7
  • 22
  • I'm confused when you say 'virtual' and Bluetooth. I'm pretty sure that the HID is available for USB and for Bluetooth, but other than showing up as HID at the highest level... – kenny Aug 25 '11 at 23:06
  • virtual is because my Mac is not really a bluetooth keyboard. its a mac. I want my mac to behave as if it was a BT keyboard, then other devices could connect to it, and I could type on them from my Mac. – eyalw Aug 28 '11 at 09:14
  • How about this one? http://www.eyalw.com/1keyboard/ – kuboon Sep 15 '12 at 07:11
  • Not a direct (technical) answer but our "Type2Phone" in the Mac AppStore does exactly this and may solve your problem. Give it a try. – mringwal Mar 12 '12 at 20:41
  • @eyalw, which HID API for Mac did you find? I am looking for something similar, I would find it most helpful if you could share your findings and give an example. – Drupad Panchal Apr 09 '13 at 20:14
  • 1
    Type2Phone costs ten dollars, so presumably has closed source code, which makes it pretty much irrelevant here, as it doesn't help anyone write code that turns a Mac into a BT keyboard. – Carl Smith Jul 18 '18 at 00:13
  • @eyalw if you ever found a solution or made headway on this, it would be amazing if you could post another answer to this question. Thanks! – George Pantazes Sep 19 '18 at 22:22

2 Answers2

1

As far as I understand it, a HID device driver represents a device locally to the OS, and by the OS, to various other components. It is not used to "broadcast" on USB nor on Bluetooth. As far as I know, OS X does not include a Bluetooth HID service, and neither does OS X nor the USB chipsets in Macs support USB device mode -- or at least they do not expose it.

You will want to write a Bluetooth service. I have not done that, but the documentation seems extensive. From what I understand, you would somehow have to implement your HID service based on the underlying Bluetooth L2CAP transmission protocol.

Since I have studied neither Bluetooth, nor Bluetooth support under Mac, I am unable to provide any more help. I did take a look at HID protocol specs, and even played with them. HID is relatively trivial to implement, but there will be quite a bit of work on implementing the Bluetooth service first.

Ivan Vučica
  • 9,529
  • 9
  • 60
  • 111
0

It seems similar tools exist for linux and may have usable source code. See this thread for links.

Community
  • 1
  • 1
AXE Labs
  • 4,051
  • 4
  • 29
  • 29