On 23.12.2017 19:01, Peter Tribble wrote:
On Sat, Dec 23, 2017 at 11:00 AM, Alexander Pyhalov <[email protected]> wrote:

Hello.

I'm trying to get a list of acpi batteries and ac devices on the notebook.
I see them in /devices/pseudo:

$ ls -ld /devices/pseudo/acpi_drv\@0*
drwxr-xr-x 2 root sys       2 Dec 23  2014 /devices/pseudo/acpi_drv@0
crw-rw-rw- 1 root sys 3, 512 Dec 23 11:32 /devices/pseudo/acpi_drv@0:ac0 crw-rw-rw- 1 root sys 3, 256 Dec 23 11:32 /devices/pseudo/acpi_drv@0:bat
tery0
crw-rw-rw- 1 root sys 3, 1280 Dec 23 11:34 /devices/pseudo/acpi_drv@0:hot
key

But when I try to do it in C, I fail. The attached program shows only

In acpi_drv
/pseudo/acpi_drv@0
is_laptop=0

(no /dev/pseudo/acpi_drv@0:* as I would expected). What am I doing wrong?


That I have no idea, but I get the same result.

Basically it's not getting into the minor loop. However, di_minor_next()
returns
DI_MINOR_NIL on failure. The failure the code is looking for is when it hits the end of the node list, but if I print out errno then I see 48, which is
ENOTSUP,
which according to the man page means "Minor node information is not
available
in snapshot." Which begs the question, how to ensure the device snapshot
contains minor node information?

Thanks, that's it.

I had to do di_init("/",DINFOSUBTREE|DINFOMINOR), not just di_init("/",DINFOSUBTREE).


---
System Administrator of Southern Federal University Computer Center


------------------------------------------
illumos-discuss
Archives: 
https://illumos.topicbox.com/groups/discuss/discussions/T736693effb971e17-M9a045f8787128f4b376ed42b
Powered by Topicbox: https://topicbox.com

Reply via email to