sshoecraft / jbdtool

JBD BMS Linux utility
BSD 3-Clause "New" or "Revised" License
46 stars 10 forks source link

Compiled ok, but errors when running #8

Closed kicomoco closed 1 year ago

kicomoco commented 2 years ago

Hi,

Hope you can help, managed to get jbdtool compiled eventually but I am getting the following error when running:

root@raspberrypi:/home/pi/jbdtoolgit# ./jbdtool -t bt:A4:C1:37:20:2B:73 -d 3 -r -a main.c(829) main: transport: 0xbee4e8c4, target: 0xbee4e8c7 main.c(855) main: transport: bt module.c(51) mybmm_load_module: NOT found. module.c(72) mybmm_load_module: init: 0x274bc module.c(79) mybmm_load_module: adding module: bt main.c(858) main: tp: 0x3f640 module.c(45) mybmm_load_module: mp->name: bt, mp->type: 2 module.c(51) mybmm_load_module: NOT found. module.c(72) mybmm_load_module: init: 0x1ae18 module.c(79) mybmm_load_module: adding module: jbd main.c(861) main: cp: 0x3f564 jbd.c(416) jbd_new: transport: bt jbd.c(425) jbd_new: pp->target: A4:C1:37:20:2B:73, pp->opts: main.c(878) main: p: 0xbee4e8d5, target: 0xbee4e8c7 main.c(880) main: lockfile: /tmp/73.lock main.c(882) main: lockfd: 3 main.c(889) main: charge: -1, discharge: -1 main.c(912) main: reset: 0 main.c(928) main: mqtt: (nil) main.c(978) main: outfp: 0x88ea60 main.c(1102) main: all: 1 jbd.c(436) jbd_open: opening... bt.c(86) bt_open: connecting to: A4:C1:37:20:2B:73 bt.c(92) bt_open: s->c: 0x89ce78 bt.c(102) bt_open: topts: bt.c(115) bt_open: uuid: 0xfa01, value_handle: 0x0018 bt.c(117) bt_open: using characteristic: 0xfa01 bt.c(132) bt_open: error: failed to start bluetooth notification. root@raspberrypi:/home/pi/jbdtoolgit#

Any ideas what the problem is?

Any help appreciated!

drbytes commented 2 years ago

I have the same issue.

jbd.c(436) jbd_open: opening...
bt.c(86) bt_open: connecting to: A4:C1:38:72:CE:8C
bt.c(92) bt_open: s->c: 0x5618bec73be0
bt.c(102) bt_open: topts:
bt.c(115) bt_open: uuid: 0xfa01, value_handle: 0x0018
bt.c(117) bt_open: using characteristic: 0xfa01
bt.c(132) bt_open: error: failed to start bluetooth notification.
drbytes commented 2 years ago

I tried it on a raspberry pi, no dice there either

drbytes@pie:~/jbdtool$ sudo ./jbdtool -t bt:A4:C1:37:00:0D:94 -r -a
error: lock_file: open(/tmp/94.lock): Permission denied
error: unable to lock target

bluetootctl can find and connect to the device without problems:

drbytes@pie:~/jbdtool$ sudo bluetoothctl
Agent registered
[CHG] Controller DC:A6:32:7D:B8:DE Pairable: yes
[bluetooth]# scan on
Discovery started
[CHG] Controller DC:A6:32:7D:B8:DE Discovering: yes
[NEW] Device A4:C1:38:72:CE:8C LH-SP20S005
[NEW] Device A4:C1:37:00:0D:94 LH-SP20S005
sshoecraft commented 2 years ago

the permission defined ... are you running it as root?

also, I FINALLY got an official JBD bluetooth module and i'll test it out.

did you try pairing the device in bluetoothctl?

sshoecraft commented 2 years ago

$ bluetoothctl

scan on

(look for your device) [NEW] Device XX:XX:XX:XX:XX:XX name

trust XX:XX:XX:XX:XX:XX

pair XX:XX:XX:XX:XX:XX

(it may ask for your passkey)