FWRITE should work in your case

- Akash

On Tue, Jun 15, 2010 at 9:27 PM, RYO IKUYAMA <[email protected]> wrote:
> Hi, Deva
>
> Thanks advice and sample code.
> Before, I used fputs() and fgets(). then, fputs() was not able to be
> done though fgets() was able to be done. filepath permission is set to
> 777 beforehand.
> Is the place of the folder path(.data/misc/cal/) bad? or  should I
> use fwrite() ?
> I try by using fwrite.
>
>
>
> sensors.c (file write test)
> ------------
> #define CALIBRATION_FILE        "/data/misc/cal/sensors.cal"
>
> static native_handle_t* control__open_data_source(struct
> sensors_control_context_t *dev)
> {
>        LOGD("control__open_data_source()");
>        native_handle_t* handle;
>        int fd = open_input(O_RDONLY);
>        if (fd < 0) {
>                return NULL;
>        }
>
>        handle = native_handle_create(1, 0);
>        handle->data[0] = fd;
>
>        LOGD("open calibration file '%s'",CALIBRATION_FILE);
>        if ((fp = fopen(CALIBRATION_FILE, "rw")) == NULL) {
>                LOGE("Couldn't open '%s'",CALIBRATION_FILE);
>        } else {
>                fputs("ABCDEFGHIJKLMN", fp);
>                fclose(fp);
>        }
>
>        return handle;
> }
>
>
> --
> nama
>
>
>
> On Wed, Jun 16, 2010 at 3:51 AM, Deva R <[email protected]> wrote:
>> There might be better ways, but to start with you can refer our sample debug
>> code, where we dump video frame data to files in filesystem.
>> http://git.omapzoom.org/?p=platform/hardware/ti/omap3.git;a=blob;f=liboverlay/v4l2_utils.c;h=cdedf1bb9af61eb0b2aa831840fd611993603e7f;hb=refs/heads/eclair#l719
>>
>> from native libraries, you can do file operations with below calls..
>> fopen(filepath)
>> fwrite()
>> fclose()
>>
>> Also, you might want to make sure the filepath have write access for the
>> process (a simple `chmod 777 <filepath>` will suffice)
>>
>> -Deva
>>
>> On Tue, Jun 15, 2010 at 8:59 AM, namaRyo <[email protected]> wrote:
>>>
>>> Hi, this is nama.
>>>
>>> I made "sensors.default.so" for arm9 dev.board - Armadillo440 (http://
>>> www.atmark-techno.com/products/armadillo/a440)
>>> use I2C accelerometer and magnetic filed sensors. and calculate to
>>> orientation.
>>>
>>> I want to save sensor calibration data to internal file at
>>> "sensors.c". and try, but, permission error occurred.
>>>
>>> How can I write to internal file system from "sensors.default.so" ?
>>>
>>> thanks,
>>>
>>> --
>>> unsubscribe: [email protected]
>>> website: http://groups.google.com/group/android-porting
>>
>>
>
> --
> unsubscribe: [email protected]
> website: http://groups.google.com/group/android-porting
>

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to