Is there a way to read the battery capacity from the Power Dock from the command line?



  • So following on with my experiments using the power dock I am curious if there is a way to read battery capacity from the dock. I don't mean via the LEDs which is not much use if you are logged into it remote or it is encased in a box.

    Does the dock communicate with the Omega at all? When the battery reaches 10% is there any way for it to warn the Omega? I doon't see it exposing any i2c devices or am I missing something?

    Also I found a bit of an odd bug. When the battery charges to 100% and the USB micro power is connected, the 5V power becomes intermittent. It sort of flashes on and off several times a second. I unplug the USB power and the 5V lines come back. This is show in the logs as the USB sound card I have connected drops off the bus.

    [34870.453018] usb 2-1: USB disconnect, device number 2
    [34889.312304] usb usb1-port1: connect-debounce failed
    [36047.021677] usb 2-1: new full-speed USB device number 3 using ohci-platform
    [36047.435388] input: C-Media Electronics Inc. USB PnP Sound Device as /devices/platform/101c1000.ohci/usb2/2-1/2-1:1.3/0003:0D8C:013C.0002/input/input1
    [36047.449995] hid-generic 0003:0D8C:013C.0002: input,hidraw0: USB HID v1.00 Device [C-Media Electronics Inc. USB PnP Sound Device] on usb-101c1000.ohci-1/input3
    [36053.950453] usb 2-1: USB disconnect, device number 3
    [36060.222050] usb 2-1: new full-speed USB device number 4 using ohci-platform
    [36060.642931] input: C-Media Electronics Inc. USB PnP Sound Device as /devices/platform/101c1000.ohci/usb2/2-1/2-1:1.3/0003:0D8C:013C.0003/input/input2
    [36060.657484] hid-generic 0003:0D8C:013C.0003: input,hidraw0: USB HID v1.00 Device [C-Media Electronics Inc. USB PnP Sound Device] on usb-101c1000.ohci-1/input3
    [36079.793706] usb 2-1: USB disconnect, device number 4
    [36110.713345] usb 2-1: new full-speed USB device number 5 using ohci-platform
    [36111.128382] input: C-Media Electronics Inc. USB PnP Sound Device as /devices/platform/101c1000.ohci/usb2/2-1/2-1:1.3/0003:0D8C:013C.0004/input/input3
    [36111.142966] hid-generic 0003:0D8C:013C.0004: input,hidraw0: USB HID v1.00 Device [C-Media Electronics Inc. USB PnP Sound Device] on usb-101c1000.ohci-1/input3

    Anyone else had this problem?



  • @T-NT said in Is there a way to read the battery capacity from the Power Dock from the command line?:

    ] usb usb1-port1: connect-debounce failed

    So been sniffing about power-dock and see it is writing to a GPIO 19 ?

    writev(1, [{iov_base="", iov_len=0}, {iov_base="> Enabling Battery Indicator LED"..., iov_len=34}], 2> Enabling Battery Indicator LEDs
    ) = 34
    open("/sys/class/gpio/gpio19/value", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
    open("/sys/class/gpio/export", O_WRONLY|O_LARGEFILE) = 3
    write(3, "19\n", 3) = 3
    close(3) = 0
    open("/sys/class/gpio/gpio19/direction", O_WRONLY|O_LARGEFILE) = 3
    write(3, "low\0", 4) = 4
    close(3) = 0
    open("/sys/class/gpio/unexport", O_WRONLY|O_LARGEFILE) = 3
    write(3, "19\n", 3) = 3
    close(3) = 0
    nanosleep({tv_sec=0, tv_nsec=200000000}, 0x7fe47e50) = 0
    open("/sys/class/gpio/gpio19/value", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
    open("/sys/class/gpio/export", O_WRONLY|O_LARGEFILE) = 3
    write(3, "19\n", 3) = 3
    close(3) = 0
    open("/sys/class/gpio/gpio19/direction", O_WRONLY|O_LARGEFILE) = 3
    write(3, "high\0", 5) = 5
    close(3) = 0
    open("/sys/class/gpio/unexport", O_WRONLY|O_LARGEFILE) = 3
    write(3, "19\n", 3) = 3
    close(3) = 0
    nanosleep({tv_sec=0, tv_nsec=100000000}, 0x7fe47e50) = 0
    open("/sys/class/gpio/gpio19/value", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
    open("/sys/class/gpio/export", O_WRONLY|O_LARGEFILE) = 3
    write(3, "19\n", 3) = 3
    close(3) = 0
    open("/sys/class/gpio/gpio19/direction", O_WRONLY|O_LARGEFILE) = 3
    write(3, "low\0", 4) = 4
    close(3) = 0
    open("/sys/class/gpio/unexport", O_WRONLY|O_LARGEFILE) = 3
    write(3, "19\n", 3) = 3
    close(3) = 0
    exit_group(0) = ?
    +++ exited with 0 +++

    Do we read from a GPIO pin for a battery level or something?



Looks like your connection to Onion Community was lost, please wait while we try to reconnect.