[Gambas-user] Writing to sysfs

Rolf Schmidt rolf.frogs at ...221...
Thu Apr 10 10:52:23 CEST 2008


Am Mittwoch, 9. April 2008 schrieb Andrew Barr:

Are you allowed to do that? I.e. does the programm run with admin rights? 
Usually writing to sysfs entries is only allowed for the admin (root).

> 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?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20080410/cbcafc3b/attachment.sig>


More information about the User mailing list