stoprocent / bleno

A Node.js module for implementing BLE (Bluetooth Low Energy) peripherals
MIT License
0 stars 0 forks source link

Crash after start paring #1

Open Alynva opened 7 months ago

Alynva commented 7 months ago

While running the examples, whenever I try to pair with my phone the program crashes with this error:

bleno - echo
on -> stateChange: poweredOn
on -> advertisingStart: success
/home/pi/Apps/blue/node_modules/@stoprocent/bleno/lib/hci-socket/crypto.js:60
  const output = Buffer.alloc(input.length);
                                    ^

TypeError: Cannot read properties of undefined (reading 'length')
    at swap (/home/pi/Apps/blue/node_modules/@stoprocent/bleno/lib/hci-socket/crypto.js:60:37)
    at e (/home/pi/Apps/blue/node_modules/@stoprocent/bleno/lib/hci-socket/crypto.js:37:9)
    at Object.c1 (/home/pi/Apps/blue/node_modules/@stoprocent/bleno/lib/hci-socket/crypto.js:22:9)
    at Smp.handlePairingRandom (/home/pi/Apps/blue/node_modules/@stoprocent/bleno/lib/hci-socket/smp.js:127:14)
    at Smp.onAclStreamData (/home/pi/Apps/blue/node_modules/@stoprocent/bleno/lib/hci-socket/smp.js:55:12)
    at AclStream.emit (node:events:525:35)
    at AclStream.push (/home/pi/Apps/blue/node_modules/@stoprocent/bleno/lib/hci-socket/acl-stream.js:20:12)
    at BlenoBindings.onAclDataPkt (/home/pi/Apps/blue/node_modules/@stoprocent/bleno/lib/hci-socket/bindings.js:198:23)
    at Hci.emit (node:events:513:28)
    at Hci.onSocketData (/home/pi/Apps/blue/node_modules/@stoprocent/bleno/lib/hci-socket/hci.js:613:16)

Node.js v18.13.0

It appears that its receiving SMP_PAIRING_RANDOM before SMP_PAIRING_CONFIRM, so this._tk doesn't have a value yet... Any clues?

stoprocent commented 1 month ago

Sorry for late reply. Can you provide some more details about setup yyou had. Hardware platform. Which BLE HCI?/Windows? etc.