abandonware / bleno

A Node.js module for implementing BLE (Bluetooth Low Energy) peripherals
https://mastodon.social/@rzr/106068437787315146#bleno
MIT License
149 stars 52 forks source link

TypeError: Cannot read property 'length' of undefined in smp.js #21

Open susy11 opened 4 years ago

susy11 commented 4 years ago

Hello,

I'm running the latest version of the bleno package and when I'm trying to swtich from a paried phone to another phone i get this error:

/home/pi/NodeBLETest/node_modules/@abandonware/bleno/lib/hci-socket/crypto.js:60 var output = new Buffer(input.length); ^

TypeError: Cannot read property 'length' of undefined at swap (/home/pi/NodeBLETest/node_modules/@abandonware/bleno/lib/hci-socket/crypto.js:60:33) at e (/home/pi/NodeBLETest/node_modules/@abandonware/bleno/lib/hci-socket/crypto.js:37:9) at Object.c1 (/home/pi/NodeBLETest/node_modules/@abandonware/bleno/lib/hci-socket/crypto.js:22:9) at Smp.handlePairingRandom (/home/pi/NodeBLETest/node_modules/@abandonware/bleno/lib/hci-socket/smp.js:130:12) at Smp.onAclStreamData (/home/pi/NodeBLETest/node_modules/@abandonware/bleno/lib/hci-socket/smp.js:58:10) at AclStream.emit (events.js:327:22) at AclStream.push (/home/pi/NodeBLETest/node_modules/@abandonware/bleno/lib/hci-socket/acl-stream.js:26:10) at BlenoBindings.onAclDataPkt (/home/pi/NodeBLETest/node_modules/@abandonware/bleno/lib/hci-socket/bindings.js:194:21) at Hci.emit (events.js:315:20) at Hci.onSocketData (/home/pi/NodeBLETest/node_modules/@abandonware/bleno/lib/hci-socket/hci.js:588:14)

Is there a way to bypass the pairing itself or the code that causes this issue?

The code runs on an RPi 4

Thanks!