Hi,
Cédric Berger wrote:
Hi,
I tried to write a little android application to be able to monitor
the charge from usb for my Freerunner (to use a car charger...)
I do not think that in current version there is a way via android API (?)
-> I tried to directly issue :
echo 500 >
/sys/class/i2c-adapter/i2c-0/0-0073/pcf50633-mbc/force_usb_limit_dangerous
This works via adb shell, when connected to my PC (and charging icon
in android goes away when switching to 100mA, comes back when 500mA)
In my application, I used Runtime.getRuntime().exec() to try to do the
same.
This way, reading current values works, so I can successfully exec :
cat /sys/class/i2c-adapter/i2c-0/0-0073/pcf50633-mbc/usb_curlim
cat /sys/class/power_supply/battery/current_now
But trying to change usb charge via exec(sh -c "echo 500 >
/sys/class/i2c-adapter/i2c-0/0-0073/pcf50633-mbc/force_usb_limit_dangerous") fails
:
"permission denied" (this is the error I get in the shell process)
The simple way is to change the permission in the init.rc file or if you
use a service, start the
service with the correct user.
Is there a way to get this to work ? Can my application request
permissions that will allow it do do this ?
Or maybe via another method, like JNI ? (but this should not grant
more rights ?)
Regards MIchael
------------------------------------------------------------------------
_______________________________________________
android-freerunner mailing list
[email protected]
http://android.koolu.org/listinfo.cgi/android-freerunner-koolu.org
_______________________________________________
android-freerunner mailing list
[email protected]
http://android.koolu.org/listinfo.cgi/android-freerunner-koolu.org