kellertk / pwnagotchi-plugin-pisugar2

A UI plugin for pwnagotchi that reads the I2C battery data from a Pisugar 2 (using a Injoinic IP5209)
37 stars 5 forks source link

Restart loops the device when plugged into usb0 #4

Open alistar79 opened 1 year ago

alistar79 commented 1 year ago

When plugged into usb0 pisugar2 is switched off and device restarts. Anyway to get it to check if usb0 is active before restarting?

alistar79 commented 1 year ago

Not sure how to poke the state of usb0 in python but have a dodgy hack as I don't think the device will hit 0 power and still shutdown gracefully so I have hacked line 90 as so

    if capacity <= self.options['shutdown']:

to

    if capacity <= self.options['shutdown'] and capacity > 0: