您尚未登录。

楼主 #1 2019-08-05 16:38:00

pqfeng
会员
注册时间: 2018-08-18
已发帖子: 129
积分: 129

请教一下,如何读取电池电量。

在V3S+AXP203的配置上,现已能正常进到console,之前进不了console的问题已解决。现在电压是有了,但不知道要如何读取电池电压电量相关的信息。如果哪位朋友知道这方面的知识,望不吝赐教。谢谢。

[    1.043151] udc-core: couldn't find an available UDC - added [g_cdc] to list of pending drivers
[    1.051978] hy46xx_ts_init  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[    1.059383] Successfully added driver hy46xx_ts
[    1.064536] sun6i-rtc 1c20400.rtc: rtc core: registered rtc-sun6i as rtc0
[    1.071422] sun6i-rtc 1c20400.rtc: RTC enabled
[    1.075984] i2c /dev entries driver
[    1.080624] i2c driver name i2c_device_probe  xxxxxxxxxxxxxxxxxxxxxxxxx
[    1.087321] i2c driver name = c0805f74   xxxxxxxxxxxxxxxxxxxxxxxxx
[    1.093533] axp20x_i2c_probe  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[    1.099317] axp20x-i2c 0-0034: AXP20x variant AXP209 found
[    1.113057] ldo1: supplied by regulator-dummy
[    1.117879] ldo2: supplied by regulator-dummy
[    1.123408] ldo3: supplied by regulator-dummy
[    1.128665] ldo4: supplied by regulator-dummy
[    1.133296] ldo5: supplied by regulator-dummy
[    1.138903] dcdc2: supplied by regulator-dummy
[    1.144108] dcdc3: supplied by regulator-dummy
[    1.150453] axp20x-i2c 0-0034: AXP20X driver loaded
[    1.156714] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[    1.165926] GPIO lookup for consumer cd
[    1.169874] GPIO lookup for consumer wp
[    1.226645] sunxi-mmc 1c0f000.mmc: base:0xc41fc000 irq:23
[    1.233691] usbcore: registered new interface driver usbhid
[    1.239360] usbhid: USB HID core driver
[    1.250667] NET: Registered protocol family 17
[    1.255229] Key type dns_resolver registered
[    1.259756] Registering SWP/SWPB emulation handler
[    1.269186] 222222222222222222222  simplefb_probe 33333333333333333333333333333
[    1.276820] simple-framebuffer 43e89000.framebuffer: framebuffer at 0x43e89000, 0x177000 bytes, mapped to 0xc4380000
[    1.287389] simple-framebuffer 43e89000.framebuffer: format=x8r8g8b8, mode=800x480x32, linelength=3200
[    1.296702] xxxxxxxxxxxxxxxxxxxxxxxxxxx  info->fix.smem_len = 1536000
[    1.311539] Console: switching to colour frame buffer device 100x30
[    1.323933] simple-framebuffer 43e89000.framebuffer: fb0: simplefb registered!
[    1.331456] GPIO lookup for consumer usb0_id_det
[    1.336136] GPIO lookup for consumer usb0_vbus_det
[    1.342039] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    1.353456] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    1.359301] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 3
[    1.369729] hub 3-0:1.0: USB hub found
[    1.375671] hub 3-0:1.0: 1 port detected
[    1.380918] using random self ethernet address
[    1.385374] using random host ethernet address
[    1.390848] usb0: HOST MAC f2:7e:ea:69:a0:ac
[    1.395165] usb0: MAC de:c7:c6:a1:99:cc
[    1.399156] g_cdc gadget: CDC Composite Gadget, version: King Kamehameha Day 2008
[    1.406675] g_cdc gadget: g_cdc ready
[    1.410614] sun6i-rtc 1c20400.rtc: setting system clock to 1970-01-01 01:50:41 UTC (6641)
[    1.419087] vcc3v0: disabling
[    1.422063] vcc5v0: disabling
[    1.425048] ALSA device list:
[    1.428069]   No soundcards found.
[    1.432363] Waiting for root device /dev/mmcblk0p2...
[    1.443955] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.453922] mmc0: new high speed SD card at address 213f
[    1.459918] mmcblk0: mmc0:213f APPSD 481 MiB
[    1.465656]  mmcblk0: p1 p2
[    1.497752] EXT4-fs (mmcblk0p2): couldn't mount as ext3 due to feature incompatibilities
[    1.506850] EXT4-fs (mmcblk0p2): couldn't mount as ext2 due to feature incompatibilities
[    1.562827] musb-hdrc musb-hdrc.1.auto: VBUS_ERROR in b_idle (80, <SessEnd), retry #0, port1 00000100
[    1.672639] EXT4-fs (mmcblk0p2): recovery complete
[    1.682162] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.690396] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    1.704729] devtmpfs: mounted
[    1.709193] Freeing unused kernel memory: 1024K
[    1.906523] EXT4-fs (mmcblk0p2): re-mounted. Opts: data=ordered
Starting logging: OK
Starting mdev...
modprobe: can't change directory to '4.13.16-licheepi-zero+': No such file or directory
Initializing random number generator... done.
Starting network: OK
#
#

离线

楼主 #3 2019-08-06 09:52:26

pqfeng
会员
注册时间: 2018-08-18
已发帖子: 129
积分: 129

Re: 请教一下,如何读取电池电量。

/dev下没有出现input 。

离线

楼主 #5 2019-08-06 14:44:25

pqfeng
会员
注册时间: 2018-08-18
已发帖子: 129
积分: 129

Re: 请教一下,如何读取电池电量。

。另外,我们写驱动程序的时候又要给用户提供接口,内核中提供给用户的接口就是sysfs,通过读取sysfs文件系统中文件内容,就可以得到电源的信息。内核主要通过两个文件power_supply_class.c和power_supply_core.c,我们调用其中的函数就可以把电源(电池,USB或AC)的信息展现给用户,有关电源的属性写在/sys/class/powersupply文件夹下(此文件夹为程序运行后所生成的)。

/sys/class/power_supply文件夹存放的是,电池驱动通过power_supply_register函数注册的各个电源属性名称


我的这个目录下没有内容啊。空的。怎么回事呢。

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn