Linux beaglebone 4.19.94+ #1 SMP PREEMPT RT Sun Apr 26 11:04:37 CEST 2020 armv7l GNU/Linux
[ 75.890362] mt7601u 1-1:1.0: Vendor request req:07 off:1700 failed:-110
[ 79.122377] mt7601u 1-1:1.0: Vendor request req:07 off:1704 failed:-110
[ 82.354362] mt7601u 1-1:1.0: Vendor request req:07 off:1708 failed:-110
[ 85.586380] mt7601u 1-1:1.0: Vendor request req:07 off:101c failed:-110
[ 88.818362] mt7601u 1-1:1.0: Vendor request req:07 off:170c failed:-110
[ 92.050380] mt7601u 1-1:1.0: Vendor request req:07 off:101c failed:-110
[ 95.282362] mt7601u 1-1:1.0: Vendor request req:07 off:1710 failed:-110
Linux beaglebone 4.19.94+ #1 SMP PREEMPT Wed Apr 29 18:35:21 CEST 2020 armv7l GNU/Linux
#!/usr/bin/python## Read some values from the PMIC and print out what we find### example i2cget -y -f 0 0x24 0x3
import timefrom os import systemimport subprocess
I2C_DEVICE = 0
CHIP_ADDRESS = 0x24
# register addresses we are interested inPPATH = 0x1CHGCONFIG0 = 0x3
STATUS = 0xAPGOOD = 0xC
# some bitmasks
STATUS_AC = 1<<3STATUS_USB = 1<<2
CHGCONFIG0_ACTIVE = 1<<3 # we are charging the battery
# these labels are interpreted from the TPS65217 datasheetCHG0_LABELS = ["Temp sense error","Pre-charge Timedout","Charge Timedout","Active (charging)","Charge Termination Current","Thermal Suspend", "DPPM Reduction","Thermal Regulation"]STATUS_LABELS=["Push Button",None,"USB Power", "AC Power"]# skip the restPGOOD_LABELS=["LDO2 power-good","LDO1 power-good","DCDC3 power-good","DCDC2 power-good","DCDC1 power-good", "LDO4 power-good","LDO3 power-good"]
# get the I2C register, strip off \n and cast to int from hex# -y means non-interactive mode (just do it!)# -f forces the connectiondef query(reg=0): return int(subprocess.check_output(["i2cget","-y" ,"-f", str(I2C_DEVICE), str(CHIP_ADDRESS), str(reg)]).strip(),16)
# display value of each bit in the register, along with its labeldef describe_bits(val,labels): for x in range(0,len(labels)): if(not labels[x]): # skip None labels continue msk = 1<<x print "%s = %d"%(labels[x],(val&msk)!=0)
# query a register, print out value breakdowndef show_reg(reg,title,labels): val = query(reg) print print "%s: r[0x%x]=0x%x\r\n"%(title,reg,val) describe_bits(val,labels) print
# specific helpersdef onBattery(): return query(STATUS) & (STATUS_AC | STATUS_USB) == 0 def charging(): return query(CHGCONFIG0) & (CHGCONFIG0_ACTIVE) !=0 if __name__ == "__main__": while True:
if onBattery():
system("shutdown -h now")
else:
print 'beep'
time.sleep(2)
[ 337.637916] musb-hdrc musb-hdrc.1: VBUS_ERROR in a_wait_vrise (88, <AValid), retry #3, port1 0008050f[ 340.807612] mt7601u 1-1:1.0: Vendor request req:07 off:180c failed:-110[ 344.040313] mt7601u 1-1:1.0: Vendor request req:02 off:180c failed:-110[ 345.584847] mt7601u 1-1:1.0: Error: send MCU cmd failed:-110[ 348.124973] mt7601u 1-1:1.0: Error: send MCU cmd failed:-110[ 351.335750] mt7601u 1-1:1.0: Vendor request req:07 off:a804 failed:-110[ 354.567797] mt7601u 1-1:1.0: Vendor request req:02 off:a804 failed:-110[ 357.799811] mt7601u 1-1:1.0: Vendor request req:07 off:106c failed:-110[ 361.031934] mt7601u 1-1:1.0: Vendor request req:02 off:106c failed:-110[ 364.263928] mt7601u 1-1:1.0: Vendor request req:02 off:a804 failed:-110[ 367.495958] mt7601u 1-1:1.0: Vendor request req:02 off:1808 failed:-110[ 370.728013] mt7601u 1-1:1.0: Vendor request req:02 off:180c failed:-110[ 373.960074] mt7601u 1-1:1.0: Vendor request req:02 off:1018 failed:-110[ 377.192115] mt7601u 1-1:1.0: Vendor request req:02 off:1010 failed:-110[ 380.424163] mt7601u 1-1:1.0: Vendor request req:02 off:1014 failed:-110
devmem2 0x47401c60 b 0x00