Skip to contentSkip to conversation

filling in ACPI method access via sysfs

PATCH Paul Ionescu 2 participants 2 messages Apr 13, 2004 1 message not in the archive ACPI

lore
Share & tools
lore
#0 lore raw

Hi Alex,

I tried to play with your new patch. I am able now to run arbitrary parameterless methods. I have some problems accessing the methods requiring parameters, or giving results.

I did an "echo 1 > /sys/.../DOCK/_DCK " but nothing happened, and I have tried also to cat it but I got "cat: Read error: No such device"

And I did an "cat /sys/.../_STA" and I receive
cat: Read error: No such device
Do I miss something ?

Thanks,
Paul

Quoted 9 lines · Alex Williamson
Quoted 8 lines

It seems unintuitive that you have to read the file for the method to take effect. How about having the write function invoke the method and (if there is a result) store it for later read-back via the read function? It should be discarded on close, of course. A read() on a file with no stored result should invoke the ACPI method (on the assumption this is a parameter-less method) and return the result directly. Closing a file should discard any result from the method.

Quoted 8 lines

How's this? It behaves the way you described, but might be doing
some questionable things with the buffer to get there. Is there a better place to store the return data than back into the buf passed to write() (aka file->private_data)? Without adding callbacks to open/close, I'm not sure how else we can dispose of the results on close. Thanks,

Alex

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 6 lines · Paul Ionescu

Hi Alex,

I tried to play with your new patch. I am able now to run arbitrary parameterless methods. I have some problems accessing the methods requiring parameters, or giving results.

Quoted 7 lines

I did an "echo 1 > /sys/.../DOCK/_DCK " but nothing happened, and I have tried also to cat it but I got "cat: Read error: No such device"

And I did an "cat /sys/.../_STA" and I receive
cat: Read error: No such device
Do I miss something ?

Yeah, the latest iteration only supports read/write to the files, I
removed support for the show/store ops. So, you need a program/script that open()s the file, write()s arguments (if any), read()s the results, and close()s the file. Thanks,

Alex

Quoted 19 lines · Alex Williamson
Quoted 17 lines
Quoted 8 lines

It seems unintuitive that you have to read the file for the method to take effect. How about having the write function invoke the method and (if there is a result) store it for later read-back via the read function? It should be discarded on close, of course. A read() on a file with no stored result should invoke the ACPI method (on the assumption this is a parameter-less method) and return the result directly. Closing a file should discard any result from the method.

How's this? It behaves the way you described, but might be doing
some questionable things with the buffer to get there. Is there a better place to store the return data than back into the buf passed to write() (aka file->private_data)? Without adding callbacks to open/close, I'm not sure how else we can dispose of the results on close. Thanks,

Alex

Signature · 9 lines
Alex Williamson                             HP Linux & Open Source Lab



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click