Open rgillan opened 3 weeks ago
confirmed with the quick start that the event never happens:
var noble = require('@stoprocent/noble');
noble.on('stateChange', async (state) => {
console.log('stateChange:' + state);
if (state === 'poweredOn') {
await noble.startScanningAsync();
}
});
noble.on('scanStart', () => { console.log('scanStart'); });
noble.on('scanStop', () => { console.log('scanStop'); });
noble.on('discover', async (peripheral) => {
await noble.stopScanningAsync();
await peripheral.connectAsync();
const {characteristics} = await peripheral.discoverSomeServicesAndCharacteristicsAsync(['180f'], ['2a19']);
const batteryLevel = (await characteristics[0].readAsync())[0];
console.log(`${peripheral.address} (${peripheral.advertisement.localName}): ${batteryLevel}%`);
await peripheral.disconnectAsync();
process.exit(0);
});
Same question As in matter.js ...
Are capabolities set correctly? https://github.com/stoprocent/noble?tab=readme-ov-file#running-without-rootsudo-linux-specific ... else try if it works with sudo then it is about this.
@Apollon77 we have tested both with and without setcap (as non root) and even running directly as root still has the same issue. This approach (set_cap_raw) is also extremely insecure as it gives this unsolicited access to any nodejs process in the machine, but that is a secondary issue for us at this point, we're just trying to get things functional and it appears that this is where it's failing on newer OS/node environments. And for completeness:
#getcap /usr/bin/node
/usr/bin/node cap_net_raw=eip
Which kernel the newest Ubuntu uses? Could it be related to https://github.com/abandonware/node-bluetooth-hci-socket/issues/60#issuecomment-2197545245
Hi Guys
I will have a look but this week is impossible for me. I still have to fix what @Apollon77 was mentioning above and I also plan to do this at the same time and we can test after.
Pulling through from here: https://github.com/abandonware/noble/issues/341