2013년 10월 25일 금요일

android init에서 service를 trigger 시키기

service insmod_ax88179 /system/bin/insmod /system/lib/modules/ax88179_178a.ko
    class core
    user root
    group root
    oneshot
                 
service insmod_smsc95xx /system/bin/insmod /system/lib/modules/smsc95xx.ko  
    class core
    user root
    group root
    oneshot


위와 같이 smsc95xx, ax88179_178a driver를 올리는 서버스를 만들어 먼저 ax88179_178a를 먼저 insmod하여 eth0를 ax88179_178a에 할당하고 싶었다.

하지만 라인 순서와 상관없이 서비스가 실행 된다.

그래서 하나의 service가 끝나고 다른 service를 trigger 시킬 방법을 찾아 보았다.

조건에 의해 실행된 서버스를 oneshot에서 disabled로 자동 실행이 되지 않도록 수정한다.
service insmod_smsc95xx /system/bin/insmod /system/lib/modules/smsc95xx.ko  
    class core
    user root
    group root
    disabled
    oneshot

그리고 첫번째 service가 실행되었는지 확인 할 수 있는 변수와 두번째 service를 실행 시킬 방법은 아래와 같다.

on property:init.svc.insmod_ax88179=stopped
    start insmod_smsc95xx

이렇게 고치면 ax88179_178a.ko가 먼저 insmod가 되고 eth0로 할당 받을 수 있다.

2013년 9월 23일 월요일

set static IP for ODROID-XU by terminal.

shell@android:/ # su
shell@android:/ # ifconfig eth0 xxx.xxx.xxx.xxx up
shell@android:/ # route add default gw xxx.xxx.xxx.xxx dev eth0
shell@android:/ # setprop net.dns1 xxx.xxx.xxx.xxx

shell@android:/ # netcfg                                                      
sit0     DOWN                                   0.0.0.0/0   0x00000080 00:00:000
eth0     UP                              xxx.xxx.xxx.xxx/24  0x00001043 86:ae:218
lo       UP                                   127.0.0.1/8   0x00000049 00:00:000
wlan0    UP                                192.168.0.88/24  0x00001043 00:08:2bf
ip6tnl0  DOWN                                   0.0.0.0/0   0x00000080 00:00:000

2013년 9월 15일 일요일

Portrait screen for ODROID-XU

edit /system/build.pro
add this line.

persist.demo.hdmirotation=portrait



edit /sdcard/boot.ini

ODROIDXU-UBOOT-CONFIG

setenv fb_x_res     "1080"
setenv fb_y_res     "1920"

setenv vout         "hdmi"

setenv left     "56"
setenv right    "24"
setenv upper    "3"
setenv lower    "3"
setenv hsync    "14"
setenv vsync    "3"

setenv hdmi_phy_res "1080"

setenv led_blink    "1"


2013년 9월 3일 화요일

ODROID-XU Update.zip included GMS(Gapps)01-Dec-2013

Last recovery firmware
http://dn.odroid.com/ODROID-XU/Firmware/01-10-2014/

last update firmware
http://dn.odroid.com/ODROID-XU/Firmware/02-13-2014/

and GApps Installer
http://codewalkerster.blogspot.kr/2013/11/universal-1-click-gapps-installer-for.html


https://drive.google.com/folderview?id=0B5aZmgmqP9rORjhTbVhqYVgySlE&usp=sharing

https://www.dropbox.com/s/amgthsz8tjfsd8b/update.zip

https://www.dropbox.com/s/amgthsz8tjfsd8b/update.zip

https://www.dropbox.com/s/szu2yax7ew08p6q/update.zip.md5sum

https://www.dropbox.com/s/szu2yax7ew08p6q/update.zip.md5sum

01 Dec 2013
support USB Gps attached by serial modem(like ttyACM or ttyUSB)

26 Nov 2013
fix 720P usb camera problem(UVC).

13 Nov 2013
support HSDPA USB dongle Modem(huawei e173)
test version.



http://www.alibaba.com/product-gs/1009044157/TJ_W803_Similar_specs_Same_Quality.html?s=p

07 Nov 2013

Asix Ethernet Adapter bug Fix.
The lock that would cause the usb3 to gigabit lan adapter is now fixed and merged.
http://git.odroid.in/odroid/linux/commit/85f0fa36e8117bd831ee9737d899f3fe5890eaac
reverse portrait screen.
ODROID-XU issue where 48kHz audio couldn't be played via alsa is now fixed.


02 Nov 2013
support UHS class for microSD.

25 Oct 2013
fix this issue.
http://forum.odroid.com/viewtopic.php?f=63&t=2111

19 Oct 2013
Update for Expansion board.
Exansion board example app.
https://www.dropbox.com/s/tbffdto7nulafuk/ExpansionBoardExample.apk



10 Oct 2013
for Kinect.
add feature CONFIG_USB_DEVICEFS.
add node for Kinect in uevnet.odroidxu.rc
add feature CONFIG_HID_APPLE.

04 Oct 2013
fix screen color problem.
http://forum.odroid.com/viewtopic.php?f=73&t=2363#p18874

01 Oct 2013
Enable ethernet on automatically.

25 Sep 2013
If ax88179(gigabit) Ethernet via USB 3.0 and smsc95xx(10/100) Ethernet via USB 2.0 is connected at the same time, then control ax88179 modules first.
It is enabled to set static IP setting for gigabit Ethernet.

23 Sep 2013
add ethernet setting for static IP


16 Sep 2013
1. fix OdroidUpdate app.
After validate update.zip, Extract update.zip automatically.
2. remove EDID function, just set HDMI phy from boot.ini.
Must update boot.ini
Example, here
http://dn.odroid.com/ODROID-XU/boot.ini/09-16-2013/




9 Sep 2013
Download update.zip and update.zip.md5sum





Move update.zip and update.zip.md5sum file from Download folder to root.




Unzip update.zip


There is update folder.


Run ODROID-XU updater app.


Click "Validate file" button.


Checking option.



and start update.

booting...


2013년 8월 26일 월요일

Unzip in Java

    private ProgressDialog mProgressDialog;
    private String unzipLocation = Environment.getExternalStorageDirectory() + "/";
    private String zipFile = Environment.getExternalStorageDirectory() + "/xxx.zip";



                unzip();


        public void unzip() throws IOException {
            mProgressDialog = new ProgressDialog(MainActivity.this);
            mProgressDialog.setMessage("Please Wait...Extracting zip file ... ");
            mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            mProgressDialog.setCancelable(false);
            mProgressDialog.show();
            new UnZipTask().execute(zipFile, unzipLocation);
        }
     
        private class UnZipTask extends AsyncTask<String, Void, Boolean> {
            @SuppressWarnings("rawtypes")
            @Override
            protected Boolean doInBackground(String... params) {
                String filePath = params[0];
                String destinationPath = params[1];
                File archive = new File(filePath);
                try {
                    ZipFile zipfile = new ZipFile(archive);
                    for (Enumeration e = zipfile.entries(); e.hasMoreElements();) {
                        ZipEntry entry = (ZipEntry) e.nextElement();
                        unzipEntry(zipfile, entry, destinationPath);
                    }
                    UnZipUtil d = new UnZipUtil();
                    d.unZip(zipFile, unzipLocation);

                    } catch (Exception e) {

                    return false;
                }
                return true;
            }

            @Override
            protected void onPostExecute(Boolean result) {
                mProgressDialog.dismiss();
            }

            private void unzipEntry(ZipFile zipfile, ZipEntry entry, String outputDir) throws IOException {
                if (entry.isDirectory()) {
                    createDir(new File(outputDir, entry.getName()));
                    return;
                }

                File outputFile = new File(outputDir, entry.getName());
                    if (!outputFile.getParentFile().exists()) {
                    createDir(outputFile.getParentFile());
                }

                // Log.v("", "Extracting: " + entry);
                BufferedInputStream inputStream = new BufferedInputStream(zipfile.getInputStream(entry));
                BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(outputFile));
                try {

                } finally {

                    outputStream.flush();
                    outputStream.close();
                    inputStream.close();
                }
            }

            private void createDir(File dir) {
                if (dir.exists()) {
                    return;
                }

                if (!dir.mkdirs()) {
                    throw new RuntimeException("Can not create dir " + dir);
                    }
            }
        }

        public class UnZipUtil {
            public boolean unZip(String zipFile, String ToPath) {
                InputStream is;
                ZipInputStream zis;
                try {
                    String filename;
                    is = new FileInputStream(zipFile);
                    zis = new ZipInputStream(new BufferedInputStream(is));        
                    ZipEntry ze;
                    byte[] buffer = new byte[1024];
                    int count;

                    while ((ze = zis.getNextEntry()) != null) {
                        // zapis do souboru
                        filename = ze.getName();

                        // Need to create directories if not exists, or
                        // it will generate an Exception...
                        if (ze.isDirectory()) {
                           File fmd = new File(ToPath + filename);
                           fmd.mkdirs();
                           continue;
                        }

                        FileOutputStream fout = new FileOutputStream(ToPath + filename);

                        // cteni zipu a zapis
                        while ((count = zis.read(buffer)) != -1) {
                            fout.write(buffer, 0, count);          
                        }

                        fout.close();            
                        zis.closeEntry();
                    }

                    zis.close();
                } catch(IOException e) {
                    e.printStackTrace();
                    return false;
                }

                return true;
            }
        }
    }

MD5SUM string in Java

    public static String createChecksum(String filename) throws Exception {
        InputStream fis =  new FileInputStream(filename);

        byte[] buffer = new byte[1024];
        MessageDigest complete = MessageDigest.getInstance("MD5");
        int numRead;

        do {
            numRead = fis.read(buffer);
            if (numRead > 0) {
                complete.update(buffer, 0, numRead);
            }
        } while (numRead != -1);

        fis.close();
        byte[] digest = complete.digest();
        StringBuffer sb = new StringBuffer();
        for (byte b : digest) {
            if ((int)(b & 0xff) <= 0xf)
                sb.append(Integer.toHexString(0));
            sb.append(Integer.toHexString((int) (b & 0xff)));
        }
 
        return sb.toString();
    }