[Gambas-user] Writing to sysfs

Benoit Minisini gambas at ...1...
Wed Apr 9 23:17:49 CEST 2008


On mercredi 9 avril 2008, Andrew Barr wrote:
> I am writing a control panel for Thinkpad laptops that basically acts as a
> graphical front end to the tp_smapi driver. It allows the user to display
> information about installed batteries and set some vendor-specific
> settings, such as threshold percentages to start/stop charging at. To do
> this, the program must read and write to nodes in sysfs. I have had no
> problem reading from sysfs using the OPEN and LINE INPUT statements, but I
> am encountering an invalid argument error when using OPEN and WRITE or
> PRINT to write the user's preferences to sysfs. Normally, this sort of
> thing is done by way of the 'echo' command, for example:
>
> # echo 0 > /sys/devices/platform/smapi/BAT0/force_discharge
>
> would disable forced discharging of the battery. Permissions are correct
> for the user that the GUI program is running under, and I can confirm by
> use of the '-n' switch to echo that the carriage return being there or not
> makes no difference to either Gambas or the sysfs interface.
>
> Ideas, anyone?

Can you give the code that you use to write "0" to the sysfs node?

-- 
Benoit Minisini




More information about the User mailing list