I managed to use a Puck as HID for macOS (was: did anybody manage to use a Puck as a HID for macOS?) #4359
Replies: 1 comment
-
Posted at 2024-11-04 by Andreas_Rozek I have just been able to successfully connect a "Flipper Zero" (see https://flipperzero.one/) to my Mac with macOS 13.6.1 and let it act as a keyboard (although it wasn't explicitly recognized as such, but only as a generic device) Thus, microcontroller-based devices are principally able to act like a keyboard - it's just that the Espruino Puck doesn't...(not out-of-the-box, at least) Posted at 2024-11-04 by @gfwilliams This seems related to the other post you made yesterday as well? Let's discuss on there: https://forum.espruino.com/conversations/400568/#comment17571727 Posted at 2024-11-04 by Andreas_Rozek sure, but this one is more general. Nevertheless, as mentioned there: just a minute ago I was able to pair a Puck with one of my Macs and send keystrokes to it - details will follow! Posted at 2024-11-04 by Andreas_Rozek what I can write so far is, that the Puck can not be paired with macOS 13.6.1, but with 15.0.1 and 15.1. However, from a macOS viewpoint, the Puck's behaviour does not seem to be "perfect" - i.e., while keystrokes can be sent, the Bluetooth section of the system settings tend to crash in various ways (sometimes, the settings app has to be restarted) My code will follow in a few hours - I have to stop here for the moment. Posted at 2024-11-04 by Andreas_Rozek Ok, here is my report: what was expected to work within an hour (I am so naive!) finally took longer than a full day... My idea was to program a Puck to send the keystrokes needed to start the dictate mode under macOS. With a BT headset and the puck in my shirt pocket, I can then dictate effortlessly without needing access to a keyboard while having full control over when the Mac is listening and when not. As mentioned above, I lost an awful lot of time with macOS 13.6.1 where the HID emulation does not seem to work at all. With macOS 15.0.1 and the new 15.1, however, it seems to work good enough to be used. "Good enough" means, that pairing still works strange from time to time:
That said, here is my code:
As you can see, I added a lot of visual feedback in form of LED signals as there is no longer any console where one could report the current state or any exceptions... Have fun! Posted at 2024-11-04 by Andreas_Rozek just a final note: I'm now looking like Captain Kirk in Star Trek when he touches his emblem to start communicating with the Enterprise... ok, perhaps not the Captain, not even Mr. Spock nor Scotty...but hopefully also not the completely unknown staff member who has to die before the episode ends... Posted at 2024-11-04 by @gfwilliams Thanks for the update, and the code! Having something to trigger the dictation mode seems like a neat ideal. In that code I don't see anything to work around the keyboard detection dialog - was that not needed in the end? Having the Bluetooth connection dialog crash and have buttons not appear sounds pretty worrying. Personally, I think regardless of what a Bluetooth device does the OS shouldn't have stuff like that happen, so I'm inclined to blame Apple for the connection issues especially as other OSes seem fine with it. Lets hope they get a fix out soon. If it helps for the future, it is possible to attach a USB-TTL dongle to the Puck (https://www.espruino.com/Puck.js#serial-console) so you can fiddle around and send commands even when you're using the Bluetooth for other things. Not ideal obviously, but better than nothing! Posted at 2024-11-04 by Andreas_Rozek Yes, I was able to simply quit the keyboard assistant without any bad consequences (what I did not know when it first appeared) And, yes, Apple never handled BT properly in the past - I always had problems. Working with a "black box" and just guessing why it does not work is quite difficult - and Apple wasn't of any help here. That said, the serial console you mentioned would have been helpful - although I wanted to avoid having to solder on the Puck device...in fact, I once hoped to complete that "little" project within an hour (oh God, I was so naive!) Nevertheless, in the end I succeeded! Thus: thanks a lot for that wonderful device called "Puck"! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2024-11-04 by Andreas_Rozek
I tried for several hours to use my Puck (with latest firmware) as a BLE keyboard for macOS 15.1, but not even the example from "https://www.espruino.com/BLE+Keyboard" is working.
I managed to pair my Puck and it was recognized as a keyboard. Somehow I was also able to skip the keyboard assistent, but pressing the Puck button simply does nothing (even when I prepare an editor and give it the keyboard focus)
Did anybody else succeed with such a scenario?
Beta Was this translation helpful? Give feedback.
All reactions