Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A13 => Topic started by: ozko on February 25, 2013, 12:54:13 PM

Title: A13 Olinuxino wifi android - FTDI usb-to-serial issue please help
Post by: ozko on February 25, 2013, 12:54:13 PM
I have an FTDI usb-to-serial cable but I cant get response from the serial device. The problem is that I don`t have root access and I cant change the eventd.rc.
As far as I know, all that I need to do is to change the /dev/bus/usb* 0660 to 0666. I`m not sure if there are going to be problems ahead. I managed to put the FTDI libs but I don`t have usb permissions.

Currently using the Android image from olimex, some FTDI sample apps for test. I can change the tty ports with chmod but when I reboot the changes are reversed. Someone told me about the init.sh in /system/etc/ but it did not work.

I dont know how to root the image so that would be helpful, or if someone have experience with usb-to-serial and can help that would be great.
I can use the tty too but I cant change the permissions to them anyway.
Title: Re: A13 Olinuxino wifi android - FTDI usb-to-serial issue please help
Post by: murerten on February 25, 2013, 09:03:10 PM
You can change the permissions by editing ueventd.sun5i.rc file. It is on top of root (/).
Title: Re: A13 Olinuxino wifi android - FTDI usb-to-serial issue please help
Post by: ozko on February 26, 2013, 01:45:12 PM
I managed to get root access and to change permissions but it seems like there are no FTDI drivers on the current kernel. Please if someone could help me to build kernel because I haven`t done such a thing so far this is the FTDI documantation http://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_132_Adding_FTDI_Devices_VCP_Driver_Support_to_Android.pdf but its for old kernel if someone could help me, because Im pretty new to this?
Title: Re: A13 Olinuxino wifi android - FTDI usb-to-serial issue please help
Post by: murerten on February 26, 2013, 08:52:26 PM
Here is a module I made:

https://docs.google.com/file/d/0B052S3HEPv_OQnNJTGZwcUJ1eW8/edit?usp=sharing (https://docs.google.com/file/d/0B052S3HEPv_OQnNJTGZwcUJ1eW8/edit?usp=sharing)

You can try it but I don't know if it works. You have to insmod it.
Title: Re: A13 Olinuxino wifi android - FTDI usb-to-serial issue please help
Post by: ozko on February 26, 2013, 10:30:44 PM
Thanks a lot  ;D you saved me! ^^
The mod works fine, but when I reboot its gone.
How can I fix this? Tried to put insmod into init.goldfish.sh in system/etc but its not working :/
Title: Re: A13 Olinuxino wifi android - FTDI usb-to-serial issue please help
Post by: murerten on February 27, 2013, 10:14:45 AM
You are right. The files on root are volatile but the /system and /data is not. In init.rc it says at the end that when boot completed it runs /system/bin/preinstall.sh. Maybe you can try that. Also you can check init.sun5i.rc how they insmod modules. You can put the module in /system/vendor/modules/. Hope you get it work.
Title: Re: A13 Olinuxino wifi android - FTDI usb-to-serial issue please help
Post by: ozko on February 27, 2013, 12:57:36 PM
That information was very helpful too, but init.sun5i.rc recover itself after reboot.
Is there a way to edit it permanently without messing with the image, because I have no experience with building or editing images?
Title: Re: A13 Olinuxino wifi android - FTDI usb-to-serial issue please help
Post by: murerten on February 27, 2013, 08:23:46 PM
I mean you can edit /system/bin/preinstall.sh; not init.sun5i.rc. Did you tried that? you can add a line like this to preinstall.sh:

/system/bin/insmod /system/vendor/modules/ftdi_sio.ko

And don't forget to copy the module to /system/vendor/modules. Once you reboot it should work I think.
Title: Re: A13 Olinuxino wifi android - FTDI usb-to-serial issue please help
Post by: murerten on February 28, 2013, 12:50:13 PM
Hi again,

You did insmod in wrong place. That if block is executed only once when you factory reset the device:


#!/system/bin/busybox sh

echo "do preinstall job"
BUSYBOX="/system/bin/busybox"

if [ ! -e /data/system.notfirstrun ]; then      
   /system/bin/sh /system/bin/pm preinstall /system/preinstall
   /system/bin/insmod /system/vendor/modules/ftdi_sio.ko
   # copy android modify tool files
   mkdir /mnt/nanda
   mount -t vfat /dev/block/nanda /mnt/nanda
#   $BUSYBOX cp /mnt/nanda/vendor/initlogo.rle /
   $BUSYBOX cp /mnt/nanda/vendor/system/build.prop /system/
   $BUSYBOX cp /mnt/nanda/vendor/system/media/bootanimation.zip /system/media/
   $BUSYBOX cp /mnt/nanda/vendor/system/usr/keylayout/*.kl /system/usr/keylayout/
   sync
   umount /mnt/nanda
   rmdir /mnt/nanda

   $BUSYBOX touch /data/system.notfirstrun   

fi

echo "preinstall ok"


To correct it do it like this:

#!/system/bin/busybox sh

echo "do preinstall job"
BUSYBOX="/system/bin/busybox"

/system/bin/insmod /system/vendor/modules/ftdi_sio.ko
chmod 0666 /dev/ttyS0
chmod 0666 /dev/ttyS1
chmod 0666 /dev/ttyS2
chmod 0666 /dev/ttyS3
chmod 0666 /dev/bus/usb/*


if [ ! -e /data/system.notfirstrun ]; then      
   /system/bin/sh /system/bin/pm preinstall /system/preinstall
   
   # copy android modify tool files
   mkdir /mnt/nanda
   mount -t vfat /dev/block/nanda /mnt/nanda
#   $BUSYBOX cp /mnt/nanda/vendor/initlogo.rle /
   $BUSYBOX cp /mnt/nanda/vendor/system/build.prop /system/
   $BUSYBOX cp /mnt/nanda/vendor/system/media/bootanimation.zip /system/media/
   $BUSYBOX cp /mnt/nanda/vendor/system/usr/keylayout/*.kl /system/usr/keylayout/
   sync
   umount /mnt/nanda
   rmdir /mnt/nanda

   $BUSYBOX touch /data/system.notfirstrun   

fi

echo "preinstall ok"


And init.goldfish.sh is executed only in emulator not on real device.
Title: Re: A13 Olinuxino wifi android - FTDI usb-to-serial issue please help
Post by: ozko on February 28, 2013, 01:01:11 PM
Thank you so much murerten!!!
Its always such small things that I have problems with.
Thank again for your help and your time!
Title: Re: A13 Olinuxino wifi android - FTDI usb-to-serial issue please help
Post by: murerten on February 28, 2013, 01:13:41 PM
Yeah those little things waste my time a lot too :)