On 18-Feb-09, at 11:18 AM, Ludwig wrote:


2009/2/18 Brian Code <[email protected]>
Hi Ludwig,

We could and would like to host any git projects that you've created to help grow the community. Please let me know if you would like to do that. I suppose the best way would be to send a tarball and I can put it up in a git. Alternatively, if you create your own git, I could pull from that.

Once again, nice work. I was wondering what was going to happen with the USB host mode. It's quite unique to the Freerunner.

Thanks,
Brian


Hi Brian,

Here are three links to tarballs from the shared libraries I needed to built to get gphoto running. Gmail apparently does not allow me any more to send tgz files, so you can download them here:

http://www.yunnanexplorer.com/static/download/libpopt.tar.gz
http://www.yunnanexplorer.com/static/download/libregex.tar.gz
http://www.yunnanexplorer.com/static/download/libltdl.tar.gz

This is only the first instalment as I am cleaning up my build.

My own server is a bit asthmatic and not all that reliable, so it would be better for Koolu to host it. Plus it keeps it all handily together.

The tarballs each build a shared library and are meant to reside in the external tree in the Android build. (Their root is at the top of the android tree).

I have taken the following convention to make these: Android.mk in the top level directory as required. Then under that is a directory called android, which contains the config.h and other android build specific files. This is to avoid anyone else to include the config.h file and to keep this hand-crafted config.h separate from any configure generated ones. I am not sure if this is the best practice...let me know if there is a better convention and I can change it. They are configured not to be in the prelink map, so no other changes are required. (I am not really sure what the prelink map really does, maybe it is a speed-up at runtime.)

libregex: this is actually the regex.c and regex.h already contained in the external/clearsilver/utils folder (which does not build a shared library on the device). Again not sure of best practice as this duplicates the code, but if at all I think it should not live under the clearsilver/utils...

libpopt:

libltdl: part of libtool, here as a separate shared library

The next ones to come would be libusb and libiconv, then the gphoto builds. Whether all this should be part of a single git for external libraries or be separate projects is up to you.

Ludwig



On 18-Feb-09, at 3:20 AM, Ludwig wrote:

I have just succeeded in running the gphoto application on my Android Freerunner. Gphoto (http://gphoto.sourceforge.net/) talks to my Nikon DSLR via USB (Android in hostmode), triggers the release shutter and downloads the photo to the phone.

In addition to the instructions given by Andy in this thread there were a number of other commands required to successfully put Android in USB host mode:

The first were to make the two files required for host mode to be made writeable. At the moment I issue the following commands:
adb shell mount -o rw,remount rootfs /
adb shell chmod 666 /sys/class/i2c-adapter/i2c-0/0-0073/neo1973-pm- host.0/hostmode
adb shell chmod 666 /sys/devices/platform/s3c2410-ohci/usb_mode
This should of course go into init.rc for production systems.

The second is to mount the usb file system with:
adb shell mount -t usbfs none /proc/bus/usb
At the moment I am at the state where I have a gphoto2 executable that I can start from the Terminal Emulator, so this is not yet run from within an Android app. Apart from not yet having written a JNI wrapper, I have the issue that reading from the usb file system requires the application to be root. I have hacked this at the moment by making my gphoto2 executable suid root. Is there a way to make this readable/writable by others (the problem is that while tethered to the computer the file system is empty and once connected to the camera I do not have a root shell any more)?

There were a number of things that I had to do to make this work that I would like to share, like compiling a number of external libraries:
libusb as a shared library
compiling ltdl into a shared library for portable shared library loading
libiconv
regex as a shared library
plus of course gphoto2 as well.
The majority of this work was to write the Android.mk files and to have suitable config.h files. What is the best way of sharing this?

Ludwig



| I would like to port the ghoto2 application, which talks to all sorts of | digital cameras over USB, to Android. It is a C library, for which a JNI | interface would have to be written so that it could be called from an | Android application. Someone else has done this (unfortunately without
| releasing the code) for another distribution on the
| freerunner: http://0x2a-blog.org/?p=49. <http://0x2a-blog.org/? p=49>

|
| The first hurdle is of course that this needs to put the freerunner into
| USB host mode. The wiki says this is TBD.
|
| I do not really know much about this. What is the state of this and what
| would need to be done on it? Is this for any reason a non-starter?
| All pointers welcome.

No it's pretty easy, you just need to cat to a couple of /sys nodes

echo 1 > /sys/class/i2c-adapter/i2c-0/0-0073/neo1973-pm-host.0/ hostmode
echo host > /sys/devices/platform/s3c2410-ohci/usb_mode

put 0 and "device" there instead to switch it back.

- -Andy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkmUJrsACgkQOjLpvpq7dMotwgCdF0khFVk5E5gKTz1F4eG/em8t
tPQAnRAMC8RDTBr8a1oIY9RAL+KgGSBg
=HLkF
-----END PGP SIGNATURE-----
_______________________________________________
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


_______________________________________________
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

Reply via email to