HID integration broken on 2v15?

Posted on
  • For investigating in the other HID project I tried to get a MDBT42Q set up as a BLE keyboard or volume control using this example from here

    Strangely, it didn't work.

    Here is my final code (mostly copied, but wrapped in an onInit() so it gets called after PowerUp):

    function onInit() {
    var kb = require("ble_hid_keyboard");
    NRF.setServices(undefined, { hid : kb.report });
    
    function btnPressed() {
      // Send 'a'
      kb.tap(kb.KEY.A, 0, function() {
        // Followed by capital 'A'
        kb.tap(kb.KEY.A, kb.MODIFY.SHIFT);
      });
    }
    
    // trigger btnPressed whenever the button is pressed
    setWatch(btnPressed, BTN, {edge:"rising",repeat:true,debounce:50})­;
    }
    

    Could someone try and confirm my results please?
    I tried both examples: The one with the keyboard and the one with the volumeUp control.
    None worked.

    Some more findings:

    • when I connect a commercial HID remote (remote selfie camera button which sends a volumeUp()) my phone (iOS) shows a confirmation dialog.
    • with Espruino this dialog is missing.
    • also the commercial remote shows up in iOS settings an (i) where I can select to "forget" (disconnect) this device
    • the Espruino does not show up with this option. The only way to disconnect is to pull off the battery.
    • when I pull the battery Espruino is gone from the list and I have to pair it again afterwards
    • the commercial remote stays in the list when switched off and is coming online again right after switching it on again.

    Is this expected behaviour or a bug?

    Thanks in advance.

  • ...

  • Thanks @Gordon.
    Do I really need this bonding call on the peripheral side?
    This thread here is a test to gain some insight how HID works as a peripheral to use it on the "other side" when Espruino is the Host/Central.

    No Code in iOS needed btw., just a confirmation (Yes/No).

    How do I setup Espruino as HID device?
    I thought that NRF.setServices(undefined, { hid : kb.report }); would do the trick.
    Is there more that is not given in the example code?

  • Sorry - I posted on the wrong thread. Got confused between this and your other one about HID! https://forum.espruino.com/conversations­/380964/#comment16739480

    I think it might be related though. iOS in particular I think is quite particular about requiring a bonded connection, when some other OSes don't.

    From http://www.espruino.com/BLE+Security#pas­skey-pin-pairing you could try also adding:

    NRF.setSecurity({passkey:"123456", mitm:1, display:1});
    

    So now when you connect iOS will want you to enter a passkey, but then the device should be bonded and maybe it'll work?

  • In developing the Rotary Encoder as mouse wheel, I tested the Espruino mouse example with the latest 2v15 release for Puck.js. It worked with no problem on Linux and IOS although I had to clear out some old pairing data by doing a complete reset of the Puck.

  • Strange. I tested also with Puck and even the newest release to rule out some Board-specific issue. No luck.
    It gets paired, but no key or volume change gets recognized by either iPhone nor MacBook.

    However, this is not the project I'm working on, just a way to debug things "from the other side".
    My original issue was just solved thanks to a hint by @Gordon :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

HID integration broken on 2v15?

Posted by Avatar for ChristianW @ChristianW

Actions