I'm working on a non phone device that run Android 2.3.3. We have a custom Android version (with some additionnal driver) and my application has "system" privileges since we build our apps with the same key used to build android.
I had unlocked full Android API (including com.android.internal.*) following this post : https://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/.
I deleted the Phone.apk from the device to ensure that no process is using rild.
I can instanciate a GSMPhone from my app, but after, I'm unable to execute any commands like supplyPin or getImei. I always have the same error :
CommandException: RADIO_NOT_AVAILABLE.
I'm really stuck here, any help would be precious.
CommandException: RADIO_NOT_AVAILABLE indicates that the rild socket is not opened. In other words, the rild service is not attached to the underlying basebane/modem you are using.
Run ps in adb shell to check if rild service is in the list. If it is in the list, run ls -l /dev/tty* and check if the modem device attached with the Android platform exists here or not. If it does not exist, it means that the Kernel is unable to enumerate your modem device and you need to add support in kernel for it. If it exists, run adb logcat -b radio and check the radio logs output which would really be helpful to diagnose the issue further.
adb shell ps | grep rild to check if RILD is in runing.
Since you can access all the api, do some initialization like PhoneApp do in Phone application OnCreate(mostly like setting params to modem, set radio power which will power on/off the modem, etc)
Related
I am trying to record my device screen using the shell command as outlined here:
http://developer.android.com/tools/help/adb.html#screenrecord
Using the verbose flag, I am getting a Permission Denial that I think is connected to the fact there is an Owner profile on the device, as it references User 0 and User 1 in the error message.
Does anyone know how I can remove the Owner profile (can't see any options to do so) or how I can set the Owner to user 0?
EDIT - clarification, the error states "broadcast asks to run as user -1 but is calling from user 0"
I got the recording to work.
It seems that for whatever reason, you need to do this via adb shell.
Whilst adb shell is running shell commands on the connected device, running the screenrecord commands directly on the device just doesn't want to work.
What I'm doing:
I've built GNU emacs for native use on an phone.
I run emacs in daemon mode on the phone, so I connect to it anytime with emacsclient, to continue working with regular files, run processes, etc.
When logging in from the terminal on the phone, I'm currently user 10157, everything works:
$ id
uid=10157(10157) gid=10157(10157)
groups=10157(10157),1015(1015),1023(1023),1028(1028),3003(3003)
When I connect via ssh to the phone from a PC (I use DigiSSHd on the phone), it logs me in as a regular user 10282, everything works:
$ id
uid=10282 gid=10282 groups=1015(1015),1023(1023),1028(1028),3003(3003)
Emacs runs fine etc. However, this way I can't connect via emacsclient to the emacs process running under user 10157. This is desirable, since I don't want to start two emacs processes, since I want to continue working with files that I have open in emacs under user 10157.
Therefore:
$ su - 10157
Fine, I can run emacs etc. However, I cannot access the web.
$ ping -c1 google.com
You must have internet permissions to use ping. Aborting.
$ id
uid=10157(10157) gid=10157(10157) groups=10157(10157)
Thus I'm no longer in group 3003, necessary for internet access, besides other groups also.
Why does this group info get stripped, and how can I remedy this, so I can continue accessing the web when su as this user under ssh?
When i run the command:
busybox --list
I don't see su in the list.
su --help
shows Superuser.apk in the help text. It means su is provided by Superuser app.
I followed the steps described by you and i could su as another user and still have internet permission as shown below.
I have the following apps installed.
BusyBox v1.18.5-Stericson
Superuser v3.0.7
Terminal Emulator v1.0.45
SSHDroid v1.9.6
Suggestion:
I think the issue is with su on your device. You may try this one.
https://play.google.com/store/apps/details?id=com.noshufou.android.su
If i just use adb shell without running SSHDroid still i can su as another user with internet permission.
Note: The BusyBox id command doesn't show groups information always.
According to the standard man page for su (from a linux box)
When - is used, it must be specified as the last su option. The other forms (-l and --login) do not have this restriction.
Based on that, try
$ su 10157 -
I'm probably missing something here because this seems way too obvious but why not just 'sudo -u 10157' your emacs program?
you'd still have access to the net and your emacs would be working. or did I miss something important?
Permissions are not environment variables that can be inherited via su -.
Moreover, gid are are hard coded and their associations with each APP uid cannot be changed after installation.
10157 should be the uid of the DigiSSHd application, thus you could try to rebuild it after changing the AndroidManifest.xml to require the proper permission.
You can find something useful here and here.
The same should work for BusyBox (see here).
However, you could open some security hole by enabling NETWORK access through such applications.
What log source is used by logcat (with default settings: adb shell logcat). Are dmesg logs included in logcat's output? If not, what's the difference between dmesg logs and logcat logs?
According to the source code https://github.com/android/platform_system_core/blob/master/liblog/logd_write.c Log.d(String tag, String message) writes directly to /dev/log/main.
You can write there like this adb shell echo "Hello world" >> /dev/log/main
But dmesg prints the contents of the kernel's ring buffer. So dmesg will print only what system writes to kernel log, logcat will output only android app's logs.
LOGCAT-- This is used in Android , to see the different messages written by the activity managers inside the Android , u see android also uses the linux kernel , but what it does is, once the kernel boots ( the hardware initialization /probing has been taken care of) , the android starts a process called init which parses the init.rc file which contains all the android system activities , i mean the basic processes for android to boot , in this init.rc file there's a process called zygote which starts the Dalvik Virtual Machine , and after that all the other activity managers , which will be used by the application to interact with the hardware . so its basically messages from the VM , for the application programmers to debug it .
logcat example
http://pastebin.com/bV1Vd6EQ
Dmesg- it is messages from the kernel , suppose u write a driver , it can be used as a tool for debugging drivers and other kernel code, most of them are driver messages its a good way of debugging , the kernel , driver etc..
dmesg example
http://pastebin.com/P4ja9PFi
Logcat is only for android and its not available in any other OS , both Logcat and dmesg is available on Android but not the vice versa for any linux distros .
regards,
zubraj
I'm trying to use touch screen with developer board running Android 2.2. I have manufacturer's instructions and I need to enable uinput process which should be visible in Android under /dev/input as uinput.
I have checked this using menuconfig:
CONFIG_INPUT_UINPUT: y/m
Device Drivers --->
Input Device Support --->
Miscellaneous devices --->
User level driver support
And the driver is already enabled but uinput is still not visible in /dev/input.
I have process uinput in /dev but it is owned by bluetooth.
Is there a way to install uinput process?
It turns out that driver was looking in both places (/dev and /dev/input) so this wasn't necessary. In case someone still needs that file to be in /dev/input location you can create symlink by putting this at the end of init.rc file:
service ln /system/bin/ln -s /dev/uinput /dev/input/uinput
user root
group root
I have a problem that has been nagging me to an extreme extend in the past few days. I would like to write an Android sh script that does the following (to help me sync music, pics etc.):
1) Turn on wifi (wifi is off by default to save power)
2) Check if my wifi connection is in range (lets call it myWifi)
3) If myWifi is not in range, disable wifi, if it is in range, connect and start some synch software
Now, to enable / disable wifi, I use the following command, which requires root:
svc wifi enable / disable
To scan for avaible wifi connections, I use the following command:
iwlist eth0 scan
The strage thing is, that iwlist eth0 scan will only work if I am NOT logged in as root (I am very curious to why this is the case, if anyone knows anything?), running it while root will return:
eth0: Interface doesn't support scanning : Invalid argument
but running it while not logged in as root, will give me the info I need. I have tried different approaches to get around this problem. The most obvious one is logging in as the standard user in the Android system right before invoking the iwlist command:
su -c app_1
However, any command that involves su will return permission denied even when invoking it as root, and since sudo does not exist in Android, I feel pretty lost here. I did also try a workaround involving splitting the script into two parts, and trying to run the first as root and the second as non root (the default user in Android i app_1), but this will only delay the problem...
If anyone has an answer to how to either get around this user problem, or how to use iwlist eth0 scan (or another command that does the same) while logged in as root, I would be very gratefull.
Thank you.
According to man iwlist normal users can only see some left-over scanning results. To initiate a new scan as root you first need to start up your interface (after starting wifi):
ifconfig wlan0 up