Edmond Rodriguez on 6 Oct 2009 11:53:21 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Failure trying to write to a file in a virtual file system


Interesting, and I unsuccessfully tried a few quick perl scripts (sysread and syswrite), though it seems a bit complicated doing things as they suggest with the buffers.  Maybe using "C" would be more appropriate.  

Curious though that I see other documentation using the "echo -n >" method to write data to /sys.

But the text you copied below looks pretty clear to me that they want the entire buffer read first, and then the entire buffer written.   Could it be saying that if you read the file, you must read the entire buffer, and same for writing?    I also ask myself, in my case, why "echo -n" works with some files, and not others.


Here is a random example I googled relating to some setting for a system:
http://eslam-linux.blogspot.com/2009/02/ibm-thinkpad-trackpoint-configuration.html
    # echo -n 255 > /sys/devices/platform/i8042/serio1/serio2/sensitivity
    # echo -n 255 > /sys/devices/platform/i8042/serio1/serio2/speed
    # echo -n 0 > /sys/devices/platform/i8042/serio1/serio2/press_to_select


----- Original Message ----
> From: Sean Collins <sean@seanmcollins.com>
> To: plug@lists.phillylinux.org
> Sent: Tuesday, October 6, 2009 12:43:11 PM
> Subject: Re: [PLUG] Failure trying to write to a file in a virtual file system
> 
> Ah - it may be this bit right here
> 
> >  When writing sysfs files, userspace processes should first read the
> >  entire file, modify the values it wishes to change, then write the
> >  entire buffer back.
> 
> http://delcom.sourceforge.net/sysfs.txt
> 
> When you echo something and pipe it into the sysfs mount, that's a  
> stream. I think sysfs wants an atomic write.
> 
> Again, a bit out on a limb here, but that's my best guess without  
> access to my linux box.
> 
> 
> 
> Thank You,
> 
> Sean Collins
> 
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> 
> ___________________________________________________________________________
> Philadelphia Linux Users Group         --        http://www.phillylinux.org
> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
> General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug