Like u recommended, i posted my query at android porting ,however,
So far i didnt get to hear from anyone,,so ,, i m still struggling
alone.....

Now i am trying to open the virtual file at bootup and reload it with
the byte stream..... However I am only able to open the virtual file
for reading and not for writing.... I think i need to change the
permissions..... How do i do that ?? Can anyone help??????

**************************************************************

The reading code is as follows: // NO BREAKAGE

byte[] buffer1 = new byte[100];
BufferedReader reader = null;
                try{
                        reader = new BufferedReader(new FileReader 
("/sys/class/lightsensor/
switch_cmd/lightsensor_file_cmd"));
                        Log.d(TAG,"Opened the SAVED virtual file");
                }catch(IOException e){
                        Log.d(TAG,"Problem opening the SAVED virtual file");
                }
                try{
                        Log.d(TAG, "Buffer read from virtual file 
="+reader.readLine());
                        Log.d(TAG,"Read the SAVED virtual file");
                        reader.close();
                }catch(IOException e){
                        Log.d(TAG,"Problem reading the SAVED virtual file");
                }

*************************************************

for writing i use the following code: // BREAKAGE WHILE OPENING THE
FILE???????

byte[] buffer = new byte[100];
buffer[0] = '1';
OutputStream out = null;
try{
                Log.d(TAG, "OPENING the virtual file");
                out = new FileOutputStream(new File("/sys/class/
lightsensor/switch_cmd/lightsensor_file_cmd"));
   }catch (FileNotFoundException e) {
                    Log.d(TAG,"Problem in Opening the virtual file for 
writing"); //
THIS LOG IS DISPLAYED
   }

try {
        Log.d(TAG, "WRITING -> Virtual file");
                out.write(buffer);
    } catch (IOException e){
                    e.printStackTrace();
                    Log.d(TAG,"Problem in Writing in the Virtual file");
   }

*****************************************************************************


Dianne Hackborn wrote:
> Hi, this is way outside of the SDK; applications should not be touching such
> things.  Please move to android-porting.
>
> On Fri, Jun 26, 2009 at 6:47 PM, Shang Hao <sahilz...@gmail.com> wrote:
>
> >
> > In my case, I mark auto brightness option in one of my apk..... This
> > would send some byte stream to  "/sys/class/lightsensor/switch_cmd/
> > lightsensor_file_cmd"..... And auto brightness will be activated once
> > this byte stream is delivered....
> >
> > However, the auto brightness capability should be ON even if I
> > reboot..... BUt since data in the file is getting deleted, auto
> > brightness feature is failing...... How can i overcome this????
> >
> > Xie xie.
> >
> > Diego Torres Milano wrote:
> > > /sys is a virtual filesystem, it doesn't persist reboots.
> > >
> > > On Jun 26, 12:18 pm, Shang Hao <sahilz...@gmail.com> wrote:
> > > > Hi,
> > > >
> > > > I am storing a byte stream @
> > > >
> > > > "/sys/class/lightsensor/switch_cmd/lightsensor_file_cmd"
> > > >
> > > > but on reboot, the value over here is getting lost..... How do i
> > > > recover????
> > > >
> > > > Xie xie.
> > >
> >
>
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to