Trying to send Key Inputs - Uncaught Error: ERR 0x3401 in function "tap" #4237
Replies: 1 comment
-
Posted at 2023-10-03 by @gfwilliams It looks like error 0x3401 is BLE_ERROR_NOT_ENABLED (although I've never seen that reported before!). I think the issue is that you've enabled BLE HID with setServices, but then you're still connected by Bluetooth so the Puck can't restart the bluetooth stack to enable HID - hence the:
message... So all you need to do is upload your code, then disconnect and reconnect (which will allow the PC to detect that the Puck is now also a Bluetooth keyboard) and then everything should be fine Posted at 2023-10-03 by l00hn Im only connecting the Puck via Edge Browser to the Espruino IDE. Even after a power cycle, Windows 11 Bluetooth "Add Device" never finds the puckjs. Connection to the Web IDE via Web Bluetooth works almost instantly. However, it throws the above error everytime I press its button. --- When I save to flash, power cycle and reconnect to the Espruino IDE, the error looks slightly different (no BLE info)
Attachments: Posted at 2023-10-04 by @gfwilliams
Ok, so are you sure that after you've saved to flash, you then tried to connect with windows Because if you saved to RAM and power cycled the Puck would have lost your code, so that's about what you'd expect. Posted at 2023-10-04 by l00hn 100sure that ive saved to flash -> ive looked into it via Espruino IDE after Power cycling. Ive also tried "Add Device" via Windows 11, the Puck just never shows up - it does show up in Chrome and Edge in the IDE though... Posted at 2023-10-04 by @gfwilliams Just looking at the code again, and one thing that is an issue (but not the whole problem) is that you're calling
So the third argument is expecting a function to call back but it's getting a variable - this is what you want I think:
But I just tried with a Puck here and the code appears to work. I've tested it on Android, iOS, Windows 10 and it all works... But I just tried Windows 11 and for some reason it doesn't show the device (Windows 10 shows loads of devices, but Windows 11 shows hardly any for me). I'll see if I can figure out what the problem is... Posted at 2023-10-04 by l00hn thanks a lot for your help! Im trying to get the combo: "WIN + ALT + B" send to Windows via Puck Keypress -> Switch HDR on and off. the above call of Posted at 2023-10-04 by @gfwilliams Ok, I've just managed to get this to appear in Windows 11 (by comparing with a Logitech device that does appear). It seems it needs an Please can you add the following code - it'll alternate advertising between the normal advert and one that includes the appearance in it, which will get Windows 11 to list it:
I'll update the docs for this, and see if I can get support for it in the firmware too. As far as I know this must be some new addition to Windows 11 as I'm pretty sure it always used to work fine in Windows 11. Posted at 2023-10-04 by l00hn The puck now shows up immedieatly in Windows 11 "Add Devices" and connects as well. With this code, on button press, it just opens the quick settings window however 😅 However, huge thanks to your help already! No way, that I could have ever figured this out by myself. Espruino IDE still throws the same error as before though - even if it works in windows. Attachments: Posted at 2023-10-04 by @gfwilliams Did you definitely use the line I'd suggested instead of what you had:
Because with the previous code of Posted at 2023-10-04 by l00hn Yes, with your line nothing happens in Windows 11. How can I send a keypress combo with more than two inputs, if not via the above comma seperated "list". Nvm, im dumb - too early.
of course you are correct. The above works fine. (Key.B instead of A) now switches Windows HDR Mode. Absolutely briliant. I love it. Thanks again! Your help has been absolutely amazing, I can now finally use my puck device! 😍 Posted at 2023-10-04 by @gfwilliams Ok, please can you try:
It's possible one of those will work? Posted at 2023-10-04 by @gfwilliams Ahh - missed that - glad it worked! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2023-10-02 by l00hn
Hi,
im trying to send keyinputs using a PuckJS ( 2v19 (c) 2021 G.Williams).
However, it throws this error, on every puck button press:
Any ideas? Im using basically the same code as from the example and other forum threads e.g https://forum.espruino.com/conversations/371473/#comment16333536
No idea why its not working.
Beta Was this translation helpful? Give feedback.
All reactions