2018년 3월 21일 수요일

OpenAuto turns a ODROID into an Android Auto Head Unit.


Android Auto with AA mirror

1. Ubuntu 16.04 mate


2. Install packages.

$ sudo apt-get update && sudo apt-get upgrade
$ sudo apt-get install -y git-core curl dh-autoreconf libboost-all-dev libusb-1.0.0-dev libssl-dev cmake  libqt5multimedia5 libqt5multimedia5-plugins libqt5multimediawidgets5 qtmultimedia5-dev libqt5bluetooth5 libqt5bluetooth5-bin qtconnectivity5-dev pulseaudio gstreamer1.0-plugins-bad  gst123 librtaudio-dev

3. auto login

$ sudo vi /usr/share/lightdm/lightdm.conf.d/60-lightdm-gtk-greeter.conf

[Seat:*]
greeter-session=lightdm-gtk-greeter
autologin-user=odroid


4. update compiler

$ gcc -v                                                     
Using built-in specs.                                                         
COLLECT_GCC=gcc                                                               
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/5/lto-wrapper             
Target: aarch64-linux-gnu                                                     
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 5.4.0-6ubu
ntu1~16.04.9' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-lan
guages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-
5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-inclu
ded-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot
=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --w
ith-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath -
-enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
 --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-arm64/jre --e
nable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-arm64 --with-j
vm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-arm64 --with-arch-directory=aar
ch64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-multiarch --enable-
fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64
-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu               
Thread model: posix                                                           
gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9)   
                                                                             
$ sudo apt-get update
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
$ sudo apt-get update
$ sudo apt-get install gcc-snapshot -y
$ sudo apt-get update
$ sudo apt-get install gcc-6 g++-6 -y
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
$ sudo update-alternatives --config gcc

$ gcc -v                                                     
Using built-in specs.                                                         
COLLECT_GCC=gcc                                                               
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/6/lto-wrapper           
Target: arm-linux-gnueabihf                                                   
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 6.3.0-18ub
untu2~16.04' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-lang
uages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6
 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir
=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-
debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-
unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-syst
em-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with
-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-armhf/jre --enable-java-home --with-jvm
-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-armhf --with-jvm-jar-dir=/usr/lib/jvm-ex
ports/java-1.5.0-gcj-6-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share
/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-m
ultiarch --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-
fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-mult
ilib --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnue
abihf --target=arm-linux-gnueabihf                                           
Thread model: posix                                                           
gcc version 6.3.0 20170519 (Ubuntu/Linaro 6.3.0-18ubuntu2~16.04)             

5. build protobuf-compiler(3.0)

5.1 get protobuf-compiler source.
$ wget https://github.com/google/protobuf/archive/v3.0.0.zip
$ unzip v3.0.0.zip
$ cd protobuf-3.0.0

5.2 fix autogen.sh

if test ! -e gmock; then
  curl $curlopts -L -O https://github.com/google/googletest/archive/release-1.7.0.zip
  unzip -q release-1.7.0.zip
  rm release-1.7.0.zip
  mkdir -p gmock/gtest
  mv googletest-release-1.7.0 gmock/gtest
fi

5.3 build
$ ./autogen.sh
$ ./configure --prefix=/usr/lib/arm-linux-gnueabihf
$ make [-j4]
$ sudo make install
$ sudo ldconfig
$ export PATH=/usr/lib/arm-linux-gnueabihf/bin/:$PATH

6. build aasdk

$ cd
$ git clone -b master https://github.com/f1xpl/aasdk.git
$ mkdir aasdk_build
$ cd aasdk_build
$ cmake -DCMAKE_BUILD_TYPE=Release ../aasdk
$ make [-j4]


7. build openauto

$ cd
$ git clone -b master https://github.com/f1xpl/openauto.git
$ mkdir openauto_build
$ cd openauto_build
$ cmake -DCMAKE_BUILD_TYPE=Release -DRPI3_BUILD=FALSE -DAASDK_INCLUDE_DIRS="/home/odroid/aasdk/include" -DAASDK_LIBRARIES="/home/odroid/aasdk/lib/libaasdk.so" -DAASDK_PROTO_INCLUDE_DIRS="/home/odroid/aasdk_build" -DAASDK_PROTO_LIBRARIES="/home/odroid/aasdk/lib/libaasdk_proto.so" ../openauto
$ make [-j4]

8. Make autostart!

$ echo "./openauto/bin/autoapp &" >> .bashrc

$ sudo usermod -a -G root odroid
$ sudo usermod -a -G tty odroid
$ sudo usermod -a -G voice odroid
$ sudo usermod -a -G input odroid
$ sudo usermod -a -G audio odroid
$ sudo usermod -a -G pulse odroid
$ sudo usermod -a -G pulse-access odroid










ODROID-C1+


ODROID-C2


9 AA Mirror

Install Android Auto 2.x version for AA Mirror.

Select "Developer"

Check "Unknown sources"



2018년 1월 16일 화요일

ODROID-C2로 오락실 게임기 만들기

여기서 recalbox OS를 다운 받는다.

https://archive.recalbox.com/

8GB Sd Card를 준비한다. OS와 ROM 파일을 큰 SD 카드에 같이 저장해도 되고 USB 이동 저장 장치에 게임 ROM만 따로 저장해도 된다.


etcher를 설치하고 다운 받은 recalbox.img.xz을 선택한다.
https://etcher.io/


게임 롬을 담을 USB stick을 준비
전체를 FAT32나 NTFS로 format한다.


ODROID-C2에 SD 카드를 연결하고 전원을 넣으면 recalbox 화면이 나온다.




XBox 조이스틱과 USB stick을 연결한다.


키는 다음과 같다.
A -> enter(OK)
B -> back
start -> setting menu


"MAIN MENU" 진입한다.


아래와 같이 "STORAGE DEVICE"에 앞에서 format한 USB Stick을 선택한다.


그리고 USB stick을 PC에 연결하면 recalbox란 폴더가 생성되어 있다.

여기서 중요한건 bios 폴더와 roms란 폴더이다.


bios란 폴더에 neogeo.zip을 넣고


roms/neogeo/ 폴더에 neogeo 게임 롬을 넣으면 된다.












2017년 8월 25일 금요일

Dual booting android and Ubuntu on ODROID-XU4

I made dual booting image for ODROID-C2.
https://codewalkerster.blogspot.kr/2016/03/dual-booting-android-and-ubuntu-on.html

We will make dual booting image for ODROID-XU3/4.

It is recommended to use a storage device of 16Gbyte or more.

Make bootable android media(eMMC or SD).

https://wiki.odroid.com/odroid-xu4/os_images/android/v5.4

Add "VFAT" to label of fat32 partition.



Download ODROID-XU3/4 Ubuntu Image.

https://wiki.odroid.com/odroid-xu4/os_images/linux/ubuntu_4.9/20170824



Copy rootfs and boot partition of ODROID-XU3/4 Ubuntu to your desktop Ubuntu.


mount disk wrote ODROID-XU3/4 Ubuntu image on your desktop PC.




$ mount
...
/.../ubuntu-16.04.3-4.9-mate* on /media/codewalker/boot type vfat (ro,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks2)
/.../ubuntu-16.04.3-4.9-mate* on /media/codewalker/rootfs type ext4 (ro,nosuid,nodev,uhelper=udisks2)


$ mkdir dual
$ cd dual
$ mkdir boot
$ sudo cp -a /media/username/boot/* boot/
$ mkdir rootfs
$ sudo cp -a /media/username/rootfs/* rootfs/


Unmount ubuntu disk image.


Delete rootfs/aafirstboot

$ rm -rf rootfs/aafirstboot

Edit rootfs/etc/fstab

$ sudo vi rootfs/etc/fstab
LABEL=VFAT /media/boot vfat defaults,rw,owner,flush,umask=000 0 0

Chagne userdata partition UUID.

- Insert disk wrote android image on your desktop PC and unmount /dev/sdX3.
$ sudo umount /dev/sdX3
$ cat rootfs/etc/fstab 
LABEL=VFAT /media/boot vfat defaults,rw,owner,flush,umask=000 0 0

UUID=e139ce78-9841-40fe-8823-96a304a09859 / ext4 errors=remount-ro,noatime 0 1

$ sudo tune2fs /dev/sdX3 -U e139ce78-9841-40fe-8823-96a304a09859

Copy ODROID-XU3/4 Ubuntu files to android disk.

$ mv /media/username/VFAT/boot. ini  /media/username/VFAT/boot. ini.android
$ cp boot/* /media/username/VFAT/
$ sudo cp rootfs/* /media/username/e139ce78-9841-40fe-8823-96a304a09859/ -a
$ sync

Make script to change OS.

in Ubuntu
$ vi boot_android.sh
------------------------------------------------------------------------
#!/bin/bash
sudo mv /media/boot/boot.ini /media/boot/boot.ini.ubuntu
sudo mv /media/boot/boot.ini.android /media/boot/boot.ini
sudo reboot
------------------------------------------------------------------------
#chmod +x boot_android.sh


in Adnroid
$ su
# mount -o rw,remount /
# vi /system/bin/boot_ubuntu.sh
------------------------------------------------------------------------
#!/bin/sh
mv /storage/internal/boot.ini /storage/internal/boot.ini.android
mv /storage/internal/boot.ini.ubuntu /storage/internal/boot.ini
reboot
------------------------------------------------------------------------
# chmod 777 /system/bin/boot_ubuntu.sh

2017년 6월 30일 금요일

How to change DDR Clock on ODROID-C2(android)

Official wiki page
http://odroid.com/dokuwiki/doku.php?id=en:c2_adjust_ddrclk

Guide to change DDR Clock by android update and recovery.

Open https://dn.odroid.com/S905/BootLoader/ODROID-C2/


Download files.
updatepackage-odroidc2-ddr-408.zip
updatepackage-odroidc2-ddr-792.zip
updatepackage-odroidc2-ddr-912.zip
updatepackage-odroidc2-ddr-1104.zip

Open Utility app.
Select "Package install from storage"



Select "File Manager" -> Download folder


Select updatepackage-odroidc2-ddr-xxx.zip wanted DDR clock.


Recovery!



After reboot, you can check the DDR configuration using the following logs of boot loader if you have a usb-uart module kit.

BL2 Built : 11:44:26, Nov 25 2015.
gxb gfb13a3b-c2 - jcao@wonton

Board ID = 8
set vcck to 1100 mv
set vddee to 1070 mv
CPU clk: 1536MHz
DDR channel setting: DDR0 Rank0+1 same
DDR0: 2048MB(auto) @ 1104MHz(2T)-14

2017년 6월 27일 화요일

How to enable Touch Wake up.

I refer to this in the site.

http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3.4-DevKit-2.1_PortingGuides?TB_iframe=true


anroid-6.0.1_r67

frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java


    /** {@inheritDoc} */
    @Override
    public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags) {
        if ((policyFlags & FLAG_WAKE) != 0) {
            if (wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotion,
                    "android.policy:MOTION")) {
                return 0;
            }
        }

        if (shouldDispatchInputWhenNonInteractive()) {
            return ACTION_PASS_TO_USER;
        }

        // If we have not passed the action up and we are in theater mode without dreaming,
        // there will be no dream to intercept the touch and wake into ambient.  The device should
        // wake up in this case.
        if (isTheaterModeEnabled() && (policyFlags & FLAG_WAKE) != 0) {
            wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotionWhenNotDreaming,
                    "android.policy:MOTION");
        }

        if (!mPowerManager.isInteractive()) {
            wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotion,
                    "android.policy:MOTION");
        }
        return 0;
    }


android-5.1.1_r38

--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -4943,6 +4943,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
             wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotionWhenNotDreaming);
         }

+        if (!mPowerManager.isInteractive()) {
+            wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotion);
+        }
+
         return 0;
     }

android-4.4.4_r2.0.1

diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 10323a4..b2da523 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -4176,6 +4176,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
         if (isWakeMotion) {
             result |= ACTION_WAKE_UP;
         }
+        if (!mPowerManager.isScreenOn())
+            mPowerManager.wakeUp(SystemClock.uptimeMillis());
         return result;
     }



2017년 4월 28일 금요일

Nexus 5X LCD 교환

약 2주전 이렇게 케이스를 잘 씌우고 다니던 스마트 폰이 재수가 없으면 뒤로 넘어져도 코가 깨진다고 액정이 박살 났습니다.



LG 서비스 센터에서 수리비가 약 12만원 정도 이길래 검색해 보니 repair kit을 Ali Express 에서 판매하고 있더군요.


생각 보다 빨리 10일 만에 도착 하여 교환 하였는데...


Nexus 5 때는 Battery가 쉽게 떼어 졌는데 이번 5X는 너무 잘 붙어 있어서 떼다가 그만 battery에서 불이 났습니다.

그 땐 당황해서 사진을 못 찍었는데 사무실에 연기로 가득차고 난리가 아니였네요.
Battery를 바닥에 집어 던졌서 바닥까지 타버렸네요.


결국 LG 서비스센터에서 Battery를 3만원 주고 사서 조립은 완성 ...
하지만 LCD가 원래색보다 파란색이 강하게 보입니다.


결론 시간에 금액에 액정 떼는 것도 힘들고 Battery 떼는 건 더 위험하고 그냥 서비스센터에서 교환하세요.

2017년 4월 21일 금요일

ODROID-C2를 CCTV로 활용하기

ODROID-C2와 Webcam을 이용하여 CCTV를 만들어 보자.

http://www.hardkernel.com/main/products/prdt_info.php?g_code=G145457216438



안드로이드 최신 버전을 다운 받는다.
http://odroid.com/dokuwiki/doku.php?id=en:c2_release_android

eMMC나 sdcard에 설치 한다.

안드로이드가 부팅이 되면 Google Apps를 설치한다.
https://codewalkerster.blogspot.kr/2016/06/how-to-install-google-play-store-on.html

Goolge Market이 설치되었으면 Google 계정을 넣고 market에서 CCTV로 검색하여 Alfred를 설치한다.

https://play.google.com/store/apps/details?id=com.ivuu


Viewer로 볼 smartphone에도 alfred를 설치한다.
ODROID-C2에 Alfred는 Camera로 설정하자.


 아래와 같이 어항을 바라보게 Webcam을 설치하였다.


Smartphone에서 아래와 같이 볼 수 있다.




2017년 3월 7일 화요일

How to Enable Multi-Window in Marshmallow.

Go back to Settings > Developer Options > go to the bottom of the Drawing category and enable Multi-window from the options.



Enable multi-window on ODROID-C2.

2017년 2월 28일 화요일

How to write to external storage on odroid(marshmallow android 6.0.1).

You maybe install utorrent app, but you can't download torrent file in external storage installed android 6.0.1(marshmallow).


Edit packages.xml.

$ su
# vi /data/system/packages.xml

<package name="com.utorrent.client" codePath="/data/app/com.utorrent.client-1" nativeLibraryPath="/data/app/com.utorrent.client-1/lib" primaryCpuAbi="armeabi-v7a" publicFlags="940097092" privateFlags="0" ft="15a648b6388" it="15a648b6f1f" ut="15a648b6f1f" version="245" userId="10069" installer="com.android.vending">
        ...
        <perms>
            ...
            <item name="android.permission.ACCESS_WIFI_STATE" granted="true" flags="0" />
            <item name="android.permission.WAKE_LOCK" granted="true" flags="0" />
            <item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" />
        </perms>


or hacking frameworks.


diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index 647c17b..1ec1fe7 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -22,6 +22,7 @@ import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED
 import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER;
 import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
 import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
+import static android.Manifest.permission.WRITE_MEDIA_STORAGE;
 import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS;
 import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER;
 import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED;
@@ -1935,6 +1936,8 @@ final class Settings {
             return;
         }

+        boolean isMediaStoragePermission = false;
+
         serializer.startTag(null, TAG_PERMISSIONS);

         for (PermissionState permissionState : permissionStates) {
@@ -1943,6 +1946,19 @@ final class Settings {
             serializer.attribute(null, ATTR_GRANTED, String.valueOf(permissionState.isGranted()));
             serializer.attribute(null, ATTR_FLAGS, Integer.toHexString(permissionState.getFlags()));
             serializer.endTag(null, TAG_ITEM);
+
+            if (!isMediaStoragePermission
+                    && permissionState.getName().equals(WRITE_MEDIA_STORAGE)) {
+                isMediaStoragePermission = true;
+            }
+        }
+
+        if (!isMediaStoragePermission) {
+            serializer.startTag(null, TAG_ITEM);
+            serializer.attribute(null, ATTR_NAME, WRITE_MEDIA_STORAGE);
+            serializer.attribute(null, ATTR_GRANTED, "true");
+            serializer.attribute(null, ATTR_FLAGS, Integer.toHexString(0));
+            serializer.endTag(null, TAG_ITEM);
         }

         serializer.endTag(null, TAG_PERMISSIONS);

Automatically permission string is inserted in packages.xml.


After install app from Market you must reboot system.