Device files of sensors - Android Q&A, Help & Troubleshooting

What are the device files of various sensors? and can we use "read" to get the info.. I'm not familiar with java and its APIs, so i want to utilize the shell and C to max...

Related

Full CAS (Computer Algebra System) on android?

We have many callculator applications on android, but they are so simple and without full mathematical functionality. So i tried port yacas to android platform, but it is a console application - so we need graphics ui.
After small searching i found this like ui on iPhone platform!
If anyone want to make this for android - i attached sources of original yacas program and of iphone-ui.
Also add some links:
http://gitorious.org/android/yacas - ported yacas application
http://yacas.sf.net - original yacas site
http://www.mathdrake.com/yacas/index.html - yacas ui for iPhone
And how you can build yacas from original tree:
Download yacas source, unpack this and cd to yacas/src,
copy XVilka-yacas.Makefile to Makefile and run:
($_XXFLAGS - optimisation flags for your device)
Code:
make CC=\"arm-android-linux-uclibcgnueabi-gcc\" CROSS_COMPILE=\"arm-android-linux-uclibcgnueabi-\" \\
CFLAGS=\" -static -fPIC $_XXFLAGS\" CXXFLAGS=\" -static -fPIC $_XXFLAGS\" \\
LDFLAGS=\" -static -fPIC -s -L$HOME/build/cross/sys-root/usr/lib -lm -lc -lgcc -lstdc++\" \\
AR=\"arm-android-linux-uclibcgnueabi-ar\" AS=\"arm-android-linux-uclibcgnueabi-as\" \\
LD=\"arm-android-linux-uclibcgnueabi-g++\" RANLIB=\"arm-android-linux-uclibcgnueabi-ranlib\" \\
OBJDUMP=\"arm-android-linux-uclibcgnueabi-objdump\" STRIP=\"arm-android-linux-uclibcgnueabi-strip\" \\
NM=\"arm-android-linux-uclibcgnueabi-nm\" CXX=\"arm-android-linux-uclibcgnueabi-g++\"
Done! we have yacas binary without any dependency.
Copy this and scripts (for example in /system/usr/local/etc/yacas)
Code:
cp /sdcard/test-build/yacas /system/usr/bin
chown root /system/bin/yacas
chmod 755 /system/bin/yacas
cp -r /sdcard/test-build/scripts/* /system/usr/local/etc/yacas
and for the first run we need to:
Code:
yacas --rootdir /system/usr/local/etc/yacas
then we can simply run yacas by the "yacas".
Hi;
This seems really excellent, I've been using calculator emulators on android to do this.
Unfortunatelly after trying the steps above, I only get "Illegal instruction" in my HTC Magic CM
Sounds cool. I might have to try this. Do you have any screenshots?
Cheers
Now we only have console version, but in future - get gui
I may not be the best programmer in the world, but if this is the best lead we have on getting a CAS on android I'd be willing to give it a go making a GUI for this.
Ok, I've managed to get yacas installed and working on my Samsung Captivate. here are the steps I used:
downloaded the my.tar.zip (it has everything already pre-compiled, thanks XVilka!)
Unzip it and copy the bin folder to an SD card.
for my Captivate, the filepath to get to my sd card may be different from yours, so be sure to check! Anyways, I used the Android SDK adb shell to get terminal access to my phone, but a terminal app on the phone itself works as well (I used adb because my laptop keyboard is quicker)
Code:
cp /sdcard/sd/bin/omap3430/yacas /system/usr/bin
chown root /system/bin/yacas
chmod 755 /system/bin/yacas
cp -r /sdcard/sd/bin/omap3430/scripts/* /system/usr/local/etc/yacas
yacas --rootdir /system/usr/local/etc/yacas
And then it should be installed properly.
So now that I have it installed and working, I need to get a feel for the syntax it uses to parse commands, get a list of commands, and start sketching out a UI for it.
Thanks for posting how to get it running on the Galaxy S.
But what about using X over SSH to run software remotely with a GUI such as Matlab? I use Matlab all the time, and loved being able to do this on the Nokia N900.
Chalup said:
Thanks for posting how to get it running on the Galaxy S.
But what about using X over SSH to run software remotely with a GUI such as Matlab? I use Matlab all the time, and loved being able to do this on the Nokia N900.
Click to expand...
Click to collapse
I don't see why you couldn't do that, however I'm a bit old fashioned and like having an offline program rather than a remote application. Plus, if I understand you correctly, running a remote version of Matlab or other similar software would not work well with the resolution available on even the enormous 4.3 inch screen of an Evo. But I'm not an expert with linux, so please correct me if I am wrong.
Is somebody still working on this?
I would really appreciate it to see a CAS App for android! Still cant understand why the devs of Space Time (iPhone) do not port their software to android...
An other cool App would be an UI that can connect to a Mathematica remote kernel...
Matlab is not a computer algebra system!
try doing d/dx(x^2) = 2x in matlab
Chalup said:
Thanks for posting how to get it running on the Galaxy S.
But what about using X over SSH to run software remotely with a GUI such as Matlab? I use Matlab all the time, and loved being able to do this on the Nokia N900.
Click to expand...
Click to collapse
I can code C-backend, but there no ppl, who want write GUI to it.
EDIT: hm found this project http://sourceforge.net/projects/yacasandroid/
This looks like it could be great. I know how to make gui's but my android development skills are raw. Yacas seems to be something you would use NDK for since you don't want to require root access. And a java implementation would not be ideal if you want speed.
Another App
Try this:
At
code . google.com/p/symja/
Look for symjadroid
You have here the link to the Android application:
http://code.google.com/p/symja/wiki/Android
Thanks.
Maxima on Android
Yes we can !! :good::good:
With graphic output.
Sorry still not links for me:
sites.google.com/site/maximaonandroid

[Q] Second Camera?

Good day...
Im wanting to connect a USB camera to my ViewSonic G Tablet... I have 3 different USB models. When I plug them in (individually,) I get the /dev/video0 device but I don't seem to be able to use the device...
Why a second camera? I'm thinking I can use my G Tab in my car with a USB camera connected for a Baby Cam (since the baby faces the other way so I can't see and most of my traveling is at night so the normal mirror won't work unless I blind the poor child...) -- In theory, it could be used as a backup camera as well. (Same effect)
The internal camera works, but I don't need to see myself, I'd rather see something behind me.
Ideas?
I've scoured the Forums in more detail... Several ask the questions and someone made it work on the Nook, but it looked Nook specific. =/
Is there a more appropriate place to ask? This would affect all Android Devices that have a USB Host Port...
Now, the G Tablet, VEGAn mod at least... has the UVC Driver for WebCams. When I plug a camera in I get the /dev/video0 device (which doesn't exist until I plug in a camera.) - could it be permissions or is the driver not fully implemented?
The mplayer app that was released sets the root path to /sdcard so I can't point it at /dev/video0... I've tried to use the stream part, but it just exits the video - no error that I can see...
adamsoutherland said:
Now, the G Tablet, VEGAn mod at least... has the UVC Driver for WebCams. When I plug a camera in I get the /dev/video0 device (which doesn't exist until I plug in a camera.) - could it be permissions or is the driver not fully implemented?
Click to expand...
Click to collapse
The device appearing is a good first sign. Can you get me a dmesg output after you've plugged the webcam in? Run a Terminal Emulator app, then type in the window:
Code:
$ [B]dmesg > /mnt/sdcard/dmesg.txt[/B]
The mplayer app that was released sets the root path to /sdcard so I can't point it at /dev/video0... I've tried to use the stream part, but it just exits the video - no error that I can see...
Click to expand...
Click to collapse
Is this app an Android port of the standard mplayer for Linux? If yes, then it will use the V4L (Video 4 Linux) API to grab video frames, and if you can start it on the command line (or supply an input file name), then you can try "tv://" as the input file name.
Run this command first, though, to give everybody read-write access to /dev/video0:
Code:
$ [B]su[/B]
# [B]chmod 666 /dev/video0[/B]
I'm attaching a dmesg prior to plugging in the camera, and one after... I'm also inserting the text of the "diff" in the post...
Code:
[ 189.574313] usb 1-1.1: new high speed USB device using tegra-ehci and address 3
[ 189.657223] usb 1-1.1: New USB device found, idVendor=18ec, idProduct=3299
[ 189.664506] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 189.671944] usb 1-1.1: Product: USB2.0 PC CAMERA
[ 189.677125] usb 1-1.1: Manufacturer: ARKMICRO
[ 189.685907] usb 1-1.1: configuration #1 chosen from 1 choice
[ 189.695760] uvcvideo: Found UVC 1.00 device USB2.0 PC CAMERA (18ec:3299)
[ 189.708989] uvcvideo: UVC non compliance - GET_DEF(PROBE) not supported. Enabling workaround.
[ 189.732392] input: USB2.0 PC CAMERA as /devices/platform/tegra-ehci.2/usb1/1-1/1-1.1/1-1.1:1.0/input/input7
[ 190.318832] SO340010: gpio_val=0xc0a50000, button_val = 0xdbaf0002
[ 190.445387] SO340010: gpio_val=0xc0a50000, button_val = 0xdbaf0000
and this:
Code:
/data/data/berserker.android.apps.sshdroid/home # ls -lh /dev/vid*
crw-rw---- 1 0 1006 81, 0 Sep 2 18:22 /dev/video0
I've also done this:
Code:
/data/data/berserker.android.apps.sshdroid/home # chmod 666 /dev/video0
/data/data/berserker.android.apps.sshdroid/home # cat /dev/video0 /mnt/sdcard/test.mpg
cat: read error: No such device
/data/data/berserker.android.apps.sshdroid/home # ls -lh /dev/vid*
crw-rw-rw- 1 0 1006 81, 0 Sep 2 18:22 /dev/video0
/data/data/berserker.android.apps.sshdroid/home #
The mplayer was an APK from someone on the forums... I've opened it up only to find a "mplayer.so" as I thought it might contain the mplayer binary... (I don't have a machine (with sufficient space) to load the Android SDK at the moment...) (It's on my todo list.)
Am I right to try "cat /dev/video0" before I find the proper mplayer or event ffmpeg binary? (It generally works in linux when I do it...)
PS - I have 3 WebCams, I can give you a dmesg of each one if you need it... They all appear to do the same thing (they are by different manufacturers... iMicro, Sabrent and Agama.) -- also note that these 3 web cams work in Linux (each slightly different, but they work.)
adamsoutherland said:
The mplayer was an APK from someone on the forums... I've opened it up only to find a "mplayer.so" as I thought it might contain the mplayer binary... (I don't have a machine (with sufficient space) to load the Android SDK at the moment...) (It's on my todo list.)
Click to expand...
Click to collapse
Attach the APK so I can have a look at it.
Am I right to try "cat /dev/video0" before I find the proper mplayer or event ffmpeg binary? (It generally works in linux when I do it...)
Click to expand...
Click to collapse
I'm surprised that that works even on standard Linux! You have to setup the frame capture parameters first using ioctl()s before you can start reading data from /dev/video0. Even after that, you get raw frame data, and not mpeg video from the device.
PS - I have 3 WebCams, I can give you a dmesg of each one if you need it... They all appear to do the same thing (they are by different manufacturers... iMicro, Sabrent and Agama.) -- also note that these 3 web cams work in Linux (each slightly different, but they work.)
Click to expand...
Click to collapse
Attach all the 3 webcams to your desktop machine, check that each one works and get me a dmesg and a lsmod command output for each one. I want to see what drivers are loaded for each one. We'll have to load the same drivers on the gTablet too after compiling them.
Code:
[I]Attach Camera1 and make sure its working, then,[/I]
desktop$ [B]dmesg > dmesg1.txt[/B]
desktop$ [B]lsmod > lsmod1.txt[/B]
[I]Attach Camera2 and make sure its working, then,[/I]
desktop$ [B]dmesg > dmesg2.txt[/B]
desktop$ [B]lsmod > lsmod2.txt[/B]
[I]Attach Camera3 and make sure its working, then,[/I]
desktop$ [B]dmesg > dmesg3.txt[/B]
desktop$ [B]lsmod > lsmod3.txt[/B]
Caveats: Even if we get all the drivers to load on the gTablet (the V4L drivers, the main camera driver, and, possibly, its support drivers), we still have the problem of displaying the video stream on Android. While I'm happy to write whatever systems code is required, writing the Java UI code for the Android app is beyond my ken. We'll have to ask someone else (try in the main Android development forums on XDA, or, ask user herbert1 here who's helped out before with custom Java apps) once we've checked that we can read data from the V4L device (I'll send you a test prog which'll output .jpg files once every second once we have the drivers sorted out).
It would be great if someone has already ported mplayer for Android.
I'm attaching the APK I found...
Side note:
After looking deeper at 'cat /dev/video0'; it does not work with these webcams... I think this works on my TV Cards that natively displayed mpeg2 video (it's been a while).
See the attached dmesg-*.txt and lsmod-*.txt. Each is named after the company logo on the camera. (I can get the model numbers if the dmesg isn't enough.) Between each dmesg I rebooted the linux box for clarity. (They can all work at once, but I get confused on what is doing what.)
The command I used to test:
Code:
ffmpeg -f alsa -i hw:0,0 -f video4linux2 -s 320x240 -i /dev/video0 test-agama.mpg
(Each of these cameras has audio - The audio is not important for what I am attempting to do...)
About the UI... I've been avoiding this but it maybe time to start work on this =P -- I just realized that the box I'm testing the cameras on has space... I may have to reload linux for 64bit but then I can install the Android SDK and get to UI Development.
All three webcams seem to depend on only 3 kernel modules: uvcvideo, videodev and v4l1_compat.
If all 3 drivers are loaded on the gTablet too, then we should be able to get the video frames from /dev/video0 (or whatever the device).
I'll send you a test program this evening. In the mean time...:
That .apk file contains the application too--the classes.dex file contains the Dalvik executable bytecode. Just install the .apk, then run the app and provide a file name as input. Try "tv://" as the file name once all 3 drivers have been loaded. Do the "chmod 666 /dev/video0" before running the app.
Try the webcam test program in the attachment. The program reads from a user-specified V4L device and outputs JPEG images until you stop it with CTRL-C. Run as:
Code:
$ [B]su[/B] [I]Become superuser[/I]
# [B]mkdir /mnt/sdcard/tmp[/B] [I]Make a tmp dir. for storing imgs[/I]
# [B]./webcam -o /mnt/sdcard/tmp[/B] [I]Capture webcam images until stopped with CTRL-C[/I]
Get usage instructions with "./webcam --help".
EDIT: I actually didn't test the program out because I couldn't locate my webcam. Report if you encounter any bugs.
Quick Update:
I will be trying this tonight... I've been busy trying to get things done. (Little one is going to be born tomorrow!)
Sorry I haven't been able to respond sooner...
rajeevvp said:
Try the webcam test program in the attachment. The program reads from a user-specified V4L device and outputs JPEG images until you stop it with CTRL-C. Run as:
Code:
$ [B]su[/B] [I]Become superuser[/I]
# [B]mkdir /mnt/sdcard/tmp[/B] [I]Make a tmp dir. for storing imgs[/I]
# [B]./webcam -o /mnt/sdcard/tmp[/B] [I]Capture webcam images until stopped with CTRL-C[/I]
Get usage instructions with "./webcam --help".
EDIT: I actually didn't test the program out because I couldn't locate my webcam. Report if you encounter any bugs.
Click to expand...
Click to collapse
I copied it to /mnt/asec (because I can execute things there without remount)
When I run it, i get:
Code:
/mnt/asec # ./webcam -o /mnt/asec/tmp -d /dev/video0
./webcam: error getting video channel info. Invalid argument
I tried without the -d /dev/video0 and got the same result.
(Sorry for the LOOONG delay... Turns out a newborn takes more time and energy than I expected. I'm just now figuring that out... =P It's worth it though.)
Try this simple USB Webcam test app in the attachment which works on VEGAn-Tab 7.1 and GtabComb* (which have the pershoot kernel).
1. Plug the USB webcam in.
Assuming the kernel you're running has the correct USB webcam drivers compiled in--and, most of them do seem to have the V4L subsystem and the UVC camera drivers (which supports a lot of the common USB webcams) built into the kernel--you should see a new /dev/video0 device file pop up.
2. Run these commands to set correct permissions and owners on the device file (some ROMs--eg. GtabCombOver--don't need it):
Code:
$ [B]su[/B]
# [B]chown system.camera /dev/video0[/B]
# [B]chmod 660 /dev/video0[/B]
(Note that if you unplug and replug the webcam, you'll have to re-run the commands on ROMs which don't set the correct permissions and owners.)
3. Now install and run the SimpleWebCam app.
If, for some reason, no /dev/video0 device is created, then your webcam may need different device drivers, which have not been compiled in (or not been written!), in which case you'll have to compile a new kernel with the correct drivers either built-in or as loadable modules. Nothing else described in this post will need change.
adamsoutherland said:
When I run it, i get:
Code:
/mnt/asec # ./webcam -o /mnt/asec/tmp -d /dev/video0
./webcam: error getting video channel info. Invalid argument
I tried without the -d /dev/video0 and got the same result.
Click to expand...
Click to collapse
Looks like I'll have to update the code to make the program use the V4L2 API instead.
Nexus 7
Just tested this on my Google Nexus 7 tablet and it worked fine, I didn't have to modify the permissions either,
PS, it is rooted, of sure if that makes much difference, will test it on my friends stock nexus 7 tomorrow
USB Camera App
I was able to get the app working on my rooted Nexus 7 4.2 and an unrooted Galaxy SIII . How hard would it be to add a video record function to the app?
droidoso said:
How hard would it be to add a video record function to the app?
Click to expand...
Click to collapse
If you want to do that, then it's better to compile a custom native camera-interface library which makes the USB webcam appear as a standard camera (--the rear one, usually). Then, you can use the standard apps to record videos.
See this thread for a precompiled binary and for the source.

Queued ADB library for .Net

Hey guys,
i developed a little wrapper class for basic Android ADB in .NET ( like there are not enough).
But haven't seen one like this. It is queued for simple use and cut of from main thread.
Process outputs are stored in easy to use C# classes like DataTable,List,string...
Options are given in enumerators.
So what does this mean:
You can simply use the methods for the tasks you want and the class will store them in its queue and runs them one after another without affecting your programm.
The 'worker' communicates througth events when
Process is started
Process is completed
Process needs interaction
State of worker changes (working/idle)
In started / stopped Event you have access to process information like:
id
processtype
arguments
outputs
outputtype ( None / Boolean / Text / List / Table )
errors
start time
stop time
duration
Functions for now:
Server Start/Kill
Devices
WaitForDevice
ListDirectory
Shell
Push / Pull
Install / Uninstall
ListPackages
Reboot
Custom Commands (without interaction)
My question is what functions of adb or fastboot should i include next?
Please send me feedback and ideas.
I actually use this in a couple of projects and it just works fine.
Feel free to try.

Need help with raw HID access of Bluetooth device from Android 5.0+

Hi all,
The Scenario
We have a bluetooth hardware device that needs to be accessed from a box (owned by client) running Android 5.1.
Box will run a customized version of Android 5.1.
The device works with vendor specific HID reports.
Changes to ROM to allow device to work are allowable.
Attempt 1:
BluetoothInputDevice + HidService
This is a hidden interface in AOSP that can provide raw hid access to bluetooth hid devices. HidService should throw intents containing received reports, and accepts reports through a "Send report" method.
Unfortunately, it didn't work for me at all. I was unable to receive any HID reports.
Attempt 2:
/dev/hidraw0 + /system/bin/hidrawservice + /system/lib/libhidrawservice.so + external/HidRawAccess/HidRawAccess.java
Here, I thought to create a native executable service hidrawservice called from init.rc with elevated privilege to access /dev/hidraw0
hidrawservice exposes its own interface for /dev/hidraw0 (maybe through a unix socket)
A java + native android service comprising libhidrawservice.so and HidRawAccess.java that exposes direct methods for hidrawservice to android java apps.
The Problems:
for 1, I could never receive any HID reports at all in my app. More details: [I cannot post links here, Sorry. Please search stackoverflow with bluetooth hid host. ]
Specifically, I observe Bluedroid doesn't call any callbacks in jni code of HidService when reports are received.
for 2, I am stuck with SELinux. I can verify that through /dev/hidraw0 the HID reports are accessible. hidrawservice when run from adb shell captures reports. But when I start it from init.rc, Its not able to access /dev/hidraw0
I don't have any prior experience on SELinux policies so if anyone could guide me, would be extremely helpful.
I am seeking community help for either of those. I am also open to any suggestions towards this. I am not seeking to disable SELinux.
If it helps, for now, I am developing with a Nexus 7 2013 tablet, And AOSP is 5.1.1_r14, LMY48G.

Custom iMX8 board with Android 10, how to develop with C++ a I2C background service?

I have a specific client request where there is a custom carried board which is controlled by a iMX8 SOM. On this board there is installed the Android system because there are specific Android applications (Java and Kotlin) which need to be run. I need to create a background service which controls specific IO peripherals (I2C, GPIOs, UART, etc...).
I suppose that in order to make a background (using the board IO peripherals) service which runs at the start of the Android OS system is to develop a C/C++ application (CMake based project) which will be cross compiled using a toolchain for the iMX8 and will be started at system boot through the "init.rc" script, right? Have you any available guide/material for such purpose so that I can begin with the best-practice solution?
I already tried using Android NDK, but I have "permission denied" errors also when installing the app in the "system/priv-app" folder (with the correct permissions).
Which is the correct way to approach this kind of project? Thank you.

Categories

Resources