[Gambas-user] Writing to sysfs

Rob sourceforge-raindog2 at ...94...
Wed Apr 9 19:47:14 CEST 2008


On Wednesday 09 April 2008 11:32, Andrew Barr wrote:
> 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. 
> Ideas, anyone?

Not to be flip, but have you tried

SHELL "echo 0 > /sys/devices/platform/smapi/BAT0/force_discharge"

?  Maybe Gambas is trying to write to the file on too low a level for 
the sysfs to be able to deal with it.  I've also gotten "Invalid 
argument" when trying to read from /dev nodes, but I think Benoit has 
already fixed that in recent builds.

You could try running the echo statement and then the pure-Gambas 
equivalent (write a command-line program to recreate that echo 
statement, and nothing else) both under strace and see if the system 
calls are different, or in a different order.  But personally I would 
just shell out to echo, because this is Linux.

Rob




More information about the User mailing list