PiSugar / pisugar-power-manager-rs

PiSugar Power Manger in rust language
https://www.pisugar.com/
GNU General Public License v3.0
130 stars 15 forks source link

PiSugar Pro with Debian kernel gets a different i2c address #24

Open steev opened 3 years ago

steev commented 3 years ago

I probably need to file this bug with rppal, but I'll post it here in case anyone else runs into it...

I've got a system that runs the Debian kernel as opposed to raspbian kernel, and after probing i2c-dev and i2c-bcm2835, the pisugar 2 pro is on i2c-3 and not i2c-0 or i2c-1 like is expected.

~/git/pisugar-power-manager-rs] # i2cdump -y -a 3 0x32
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 10 57 98 06 03 04 21 00 00 00 00 00 00 00 00 00    ?W????!.........
10: 10 00 00 00 00 00 2b 00 82 00 e0 3e 00 00 03 4f    ?.....+.?.?>..?O
20: 54 24 02 17 07 01 01 27 00 08 07 01 56 32 2e 30    T$?????'.???V2.0
30: 50 69 53 75 67 61 72 20 54 65 61 6d 20 20 20 20    PiSugar Team
40: 4d 61 64 65 20 62 79 20 68 75 6d 61 6e 20 6f 6e    Made by human on
50: 65 61 72 74 68 2e 20 20 20 20 20 20 20 20 20 20    earth.
60: 77 77 77 2e 50 69 53 75 67 61 72 2e 63 6f 6d 20    www.PiSugar.com
70: 20 20 17 11 09 39 17 34 11 86 ff ff ff ff ff ff      ???9?4??......
80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

What I had to do was fork the rppal repo, and modify the line that sets the bus from 1 to 3, and then modified the pisugar-core cargo toml to point to my local checkout that has the info in there. Once I did this, I was able to use the manager correctly.

steev commented 3 years ago

rppal 0.12 has a fix for the issue (see the mentioned issue above)