• I am trying to add iOS Home button to ble_hid_controls.js module, but as AC Home id
    is 0x223 it needs a different report to include it. I tried to add it as an Usage (0x0a, 0x23, 0x2) but it doesn't work :(

    another approach was to send bytes instead of usage bits, still no lock . maybe I dont set it up properly for Generic GUI Application Controls ?

    btw, on a Windows machine 0x223 opens Internet Explorer (or maybe the default browser) ;)

    any pointers ? as I am loosing my mind to send a simple command.

    ps. puck.js rulz (1 day user here). thanks @Gordon

  • Do you have a device handy that implements it properly? Even if it's a USB one?

    You might be able to dump the report descriptor that it uses and copy it? I'm afraid I can't be much help, except to say that I'm pretty sure all the HID report arrays use 8 bit values, so I'm not quite sure where 0x223 fits in? If you send that directly it'll get cropped down to 0x23, which might explain some of your problems?

  • thanks to Raspberry PI Bluetooth implementation I was able to sniff around my Puck and another device that sends the Home button correctly :

    bluetoothctl of my Puck
    > info F5:BB:1E:D3:CB:34
    Device F5:BB:1E:D3:CB:34
    	Name: Puck.js cb34
    	Alias: Puck.js cb34
    	Paired: yes
    	Trusted: no
    	Blocked: no
    	Connected: yes
    	LegacyPairing: no
    	UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
    	UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
    	UUID: Human Interface Device    (00001812-0000-1000-8000-00805f9b34fb)
    	UUID: Nordic UART Service       (6e400001-b5a3-f393-e0a9-e50e24dcca9e)
    
    from command line get the report descriptor
    > cat /sys/kernel/debug/hid/0005\:0000\:0000.000F/rdesc
    05 0c 09 01 a1 01 85 00 15 00 26 80 03 19 00 2a 80 03 75 10 95 01 81 00 c0
    
    btmon sniffing the press of my Puck
    > ACL Data RX: Handle 64 flags 0x02 dlen 9                                                 
          ATT: Handle Value Notification (0x1b) len 4
            Handle: 0x0015
              Data: 2302
    > ACL Data RX: Handle 64 flags 0x02 dlen 9                                                 
          ATT: Handle Value Notification (0x1b) len 4
            Handle: 0x0015
              Data: 0000
    
    // my code with the report taken from the other device
    var report = new Uint8Array([
    0x05, 0x0C,        // Usage Page (Consumer)
    0x09, 0x01,        // Usage (Consumer Control)
    0xA1, 0x01,        // Collection (Application)
    0x15, 0x00,        //   Logical Minimum (0)
    0x26, 0x80, 0x03,  //   Logical Maximum (896)
    0x19, 0x00,        //   Usage Minimum (Unassigned)
    0x2A, 0x80, 0x03,  //   Usage Maximum (0x0380)
    0x75, 0x10,        //   Report Size (16)
    0x95, 0x01,        //   Report Count (1)
    0x81, 0x00,        //   Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
    0xC0,              // End Collection
    // 25 bytes
    ]);
    
    NRF.setServices(undefined, {
     hid : report
    });
    
    NRF.on('connect', function(addr) {
      digitalPulse(LED3, 1, 1000);
    });
    
    NRF.on('disconnect', function(addr) {
      digitalWrite(LED3, 0);
    });
    
    function p(c,cb) {
      NRF.sendHIDReport(c, function() {
        setTimeout(function(){
          NRF.sendHIDReport([0,0], cb);
        },500);
      });
    }
    
    setWatch(function(){
      try{
        digitalPulse(LED1, 1, 50);
        p([0x23, 0x02],function(){print('done');});
      } catch (e) {
        print(e);
        digitalPulse(LED3, 1, [50,50,50,50,50]);
      }
    }, BTN, {edge:"rising",repeat:true, debounce:50});
    

    **and the sniff of the other device that works **

    > ACL Data RX: Handle 12 flags 0x02 dlen 8                                                 
          Channel: 65 len 4 [PSM 0 mode 0] {chan 0}
            a1 03 23 02                                      ..#.
    > ACL Data RX: Handle 12 flags 0x02 dlen 8                                                 
          Channel: 65 len 4 [PSM 0 mode 0] {chan 0}
            a1 03 00 00                                      ....
    

    I tried with the ble_hid_controls.js module and it works on iPhone (almost same btmon trace but just 1 byte sent instead of 2).

  • That other device does seem to be sending a1 03 23 02 rather than just 23 02. Have you tried:

    NRF.sendHIDReport([0xa1,0x03,0x23,0x02], function() {
        setTimeout(function(){
          NRF.sendHIDReport([0xa1,0x03,0,0], cb);
        },500);
      });
    

    Not sure why you should need it, but hey...

  • nope. the other has report id 3, so 0xA1 0x3 is the report selector. read somewhere that maybe iOS doesn't work on a consumer only report, but it works with 0xEA (volume down) or 0xE9 (volume up), so it is something about the report that doesn't setup properly.

    found out that web relay works so I can develop on laptop and upload without the disconnect, unpair, pair on ios, try it :)

  • managed to get 0x221 (AC Search) to activate (jumps to iOS Spotlight search) , but still no Home button 😢

  • @user54159 – tried it. didn't help.
    @Adam79 – devzone post was the thing that started all. interesting about Accessibility feature, but the blue rectangle around each UI object is too distracting for me.

    I am playing now on making it discoverable as a keyboard, maybe that's why iOS is ignoring it.

  • I am playing now on making it discoverable as a keyboard, maybe that's why iOS is ignoring it.

    Have you had any luck pairing it as a normal BLE Keyboard using the example code? It might help to narrow down any issues. I'm pretty sure I've had that going on iOS just fine.

    Come to think of it, are there any iOS debug logs you can get at? They might give you some useful info?

  • yes, both "Puck.js and HID Keyboards" tutorials work great on iOS (just that it disabled the OS virtual keyboard and I can only enter aA 😝 )

    digging through iOS debug logs to see if there is something interesting. found out that Facebook is active scanning for 10 seconds. maybe for https://placetips.fb.com feature

  • just that it disabled the OS virtual keyboard and I can only enter aA

    Argh, yeah, that's not good!

  • For example, a standard HID command may be mapped to an operating system function that enables/disables the on-screen keyboard (e.g., a standard HID Usage ID may be remapped to the standard AL Keyboard Layout HID Usage Name to toggle the on-screen keyboard of the target device 102).
    --- from https://www.google.com/patents/WO2015031736A2?cl=en

    I think that Android has the same problem when an external keyboard is connected

  • bought a small speaker ( https://www.anker.com/products/variant/SoundCore-Mini-Bluetooth-Speaker/A3101111 ) and found out that it has BLE, Siri support and battery in status bar.

    so it is time for more sniffing :)

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

support for iOS Home button in ble_hid_controls.js module

Posted by Avatar for tbd @tbd

Actions