manekinekko / cafy

An experimental node package to interact with the Delonghi Primadonna Elite (and probably other ECAM models)
MIT License
53 stars 8 forks source link

Operation not permitted #2

Closed eyalcha closed 3 years ago

eyalcha commented 3 years ago

Coffee machine: ECAM 370.95 Hardware: Raspberry pi 3

Running npm start gives the following result:

> @manekinekko/cafy@1.0.0 start
> npm run build && DEBUG=*,-noble node dist/index.js

> @manekinekko/cafy@1.0.0 build
> tsc

  App BLE: activating... +0ms
  hci setting filter to: 1600000020c10000000000400000 +0ms
  hci set event mask - writing: 01010c08fffffbff07f8bf3d +5ms
  hci onSocketError: EPERM, Operation not permitted +1ms
noble warning: adapter state unauthorized, please run as root or with sudo
               or see README for information on running without root/sudo:
               https://github.com/sandeepmistry/noble#running-on-linux
  App BLE: state= unauthorized +42ms
  hci set le event mask - writing: 010120081f00000000000000 +12ms
  hci onSocketError: EPERM, Operation not permitted +2ms
  hci read local version - writing: 01011000 +1ms
  hci write LE host supported - writing: 016d0c020100 +2ms
  hci onSocketError: EPERM, Operation not permitted +0ms
  hci read LE host supported - writing: 016c0c00 +2ms
  hci onSocketError: EPERM, Operation not permitted +1ms
  hci read bd addr - writing: 01091000 +1ms
  hci onSocketData: 040e0c0101100007fc01070f000922 +6ms
  hci   event type = 4 +2ms
  hci   sub event type = 14 +0ms
  hci       cmd = 4097 +2ms
  hci       status = 0 +1ms
  hci       result = 07fc01070f000922 +0ms
  hci set scan enabled - writing: 010c20020001 +3ms
  hci onSocketError: EPERM, Operation not permitted +1ms
  hci set scan parameters - writing: 010b200701100010000000 +1ms
  hci onSocketError: EPERM, Operation not permitted +1ms
  hci onSocketData: 040e0a01091000c15cabeb27b8 +1ms
  hci   event type = 4 +1ms
  hci   sub event type = 14 +0ms
  hci       cmd = 4105 +1ms
  hci       status = 0 +0ms
  hci       result = c15cabeb27b8 +0ms
  hci address = b8:27:eb:ab:5c:c1 +1ms
  App packets to send: id= health_check +5s
  App                 hex= [0d 05 75 0f da 25] (6) +3ms
  App                 dec= [13 5 117 15 -38 37] (6) +1ms
  App Warning: Trying to send packets but connection is not ready. Retrying... (5) +1ms
  App packets to send: id= health_check +1s
  App                 hex= [0d 05 75 0f da 25] (6) +1ms
  App                 dec= [13 5 117 15 -38 37] (6) +1ms
  App Warning: Trying to send packets but connection is not ready. Retrying... (4) +0ms
  App packets to send: id= health_check +1s
  App                 hex= [0d 05 75 0f da 25] (6) +2ms
  App                 dec= [13 5 117 15 -38 37] (6) +0ms
  App Warning: Trying to send packets but connection is not ready. Retrying... (3) +1ms
  App packets to send: id= health_check +1s
  App                 hex= [0d 05 75 0f da 25] (6) +1ms
  App                 dec= [13 5 117 15 -38 37] (6) +0ms
  App Warning: Trying to send packets but connection is not ready. Retrying... (2) +1ms
  App packets to send: id= health_check +1s
  App                 hex= [0d 05 75 0f da 25] (6) +3ms
  App                 dec= [13 5 117 15 -38 37] (6) +0ms
  App Warning: Trying to send packets but connection is not ready. Retrying... (1) +1ms
  App Abort +0ms
  App disconnecting... +1ms
  hci set scan enabled - writing: 010c20020001 +9s
  hci onSocketError: EPERM, Operation not permitted +1ms
manekinekko commented 3 years ago

Thank you for reporting this issue. It looks like you can fix this by applying the command:

sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)

More info here: https://github.com/noble/noble#running-on-linux

eyalcha commented 3 years ago

Issue was solve with the setcap command