2013년 7월 4일 목요일

Use USB GPS for ODROID

android에 외장형 USB GPS를 연결하여 보자.

아래 보이는 USB 타입 GPS는 ACM 드라이버로 붙습니다.

http://www.ascenglobal.com/info.asp?id=139

kernel에서 ACM을 추가한다.
*** USB Device Class drivers ***                                                                                                
<*>   USB Modem (CDC ACM) support
< >   USB Printer support


아래 링크에서 gps 소스를 다운 받는다.
https://www.dropbox.com/s/tp8zp5grnpis51r/libodroid-gps.tar.gz


device/hardkernel/proprietary/libodroid-gps에 압축을 푼다.


device.mk에 gps가 포함이 되도록 수정한다.
# gps
PRODUCT_PACKAGES += \
    gps.$(TARGET_PRODUCT)

BoardConfig.mk
# GPS                                                                
BOARD_HAVE_ODROID_GPS := true
BOARD_SUPPORT_EXTERNAL_GPS := true 

uevent.odroid[X].rc
 62 #for gps
 63 /dev/ttyACM0    0666    gps     gps
 64 /dev/ttyUSB0    0666    gps     gps


hardware/libhardware/hardware.c
 91     /* Check that the id matches */
 92     if (strcmp(id, hmi->id) != 0) {
 93         ALOGE("load: id=%s != hmi->id=%s", id, hmi->id);
 94         status = -EINVAL;
 95         goto done;
 96     }
 97
 98     //codewalker
 99     if(hmi->dso)
100         hmi->dso = handle;
101
102     /* success */
103     status = 0;





How to support NTFS fs with External Storage.

안드로이드의 external storage(USB Mass Storage)에 NTFS 파일 시스템을 지원하기

android_4.2.2 (BUILD_ID=JDQ39E)

storage_list.xml에 item을 추가한다.
device/hardkernel/odroid/overlay/frameworks/base/core/res/res/xml/storage_list.xml

<storage android:mountPoint="/storage/usb1"

             android:storageDescription="@string/storage_usb"
             android:primary="false"
             android:removable="true" />

USB Mass Storage를 연결 하면 발생하는 노드를 vold.fstab에 추가 한다.
device/hardkernel/odroid/conf/vold.fstab

dev_mount usb /storage/usb1 auto /devices/platform/xxx

init.odroid.rc에 node를 만든다.
device/hardkernel/odroid/conf/init.odroid.rc

mkdir /storage/usb1 0000 system system

system/vold를 수정 한다.

$ svn diff
Index: Volume.cpp
===================================================================
--- Volume.cpp (revision 21)
+++ Volume.cpp (working copy)
@@ -44,6 +44,7 @@
 #include "VolumeManager.h"
 #include "ResponseCode.h"
 #include "Fat.h"
+#include "Ntfs.h"
 #include "Process.h"
 #include "cryptfs.h"

@@ -401,7 +402,13 @@
         if (Fat::check(devicePath)) {
             if (errno == ENODATA) {
                 SLOGW("%s does not contain a FAT filesystem\n", devicePath);
-                continue;
+ if (Ntfs::doMount(devicePath, getMountpoint(), false, false, false,
+ 1000, 1015, 0702, false)) {
+ SLOGE("%s failed to mount via NTFS (%s)\n", devicePath, strerror(errno));
+ } else {
+ SLOGE("NTFS mounted");
+                 continue;
+ }
             }
             errno = EIO;
             /* Badness - abort the mount */
Index: Android.mk
===================================================================
--- Android.mk (revision 21)
+++ Android.mk (working copy)
@@ -12,6 +12,7 @@
  Process.cpp \
  Ext4.cpp \
  Fat.cpp \
+ Ntfs.cpp \
  Loop.cpp \
  Devmapper.cpp \
  ResponseCode.cpp \



Ntfs.h


  1 /*
  2  * Copyright (C) 2008 The Android Open Source Project
  3  *
  4  * Licensed under the Apache License, Version 2.0 (the "License");
  5  * you may not use this file except in compliance with the License.
  6  * You may obtain a copy of the License at
  7  *
  8  *      http://www.apache.org/licenses/LICENSE-2.0
  9  *
 10  * Unless required by applicable law or agreed to in writing, software
 11  * distributed under the License is distributed on an "AS IS" BASIS,
 12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  * See the License for the specific language governing permissions and
 14  * limitations under the License.
 15  */
 16
 17 #ifndef _NTFS_H
 18 #define _NTFS_H
 19
 20 #include <unistd.h>
 21
 22 class Ntfs {
 23 public:
 24     static int doMount(const char *fsPath, const char *mountPoint,
 25                        bool ro, bool remount, bool executable,
 26                        int ownerUid, int ownerGid, int permMask,
 27                        bool createLost);
 28 };
 29
 30 #endif


Ntfs.cpp


  1 /*
  2  * Copyright (C) 2008 The Android Open Source Project
  3  *
  4  * Licensed under the Apache License, Version 2.0 (the "License");
  5  * you may not use this file except in compliance with the License.
  6  * You may obtain a copy of the License at
  7  *
  8  *      http://www.apache.org/licenses/LICENSE-2.0
  9  *
 10  * Unless required by applicable law or agreed to in writing, software
 11  * distributed under the License is distributed on an "AS IS" BASIS,
 12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  * See the License for the specific language governing permissions and
 14  * limitations under the License.
 15  */
 16
 17 #include <stdio.h>
 18 #include <fcntl.h>
 19 #include <unistd.h>
 20 #include <errno.h>
 21 #include <string.h>
 22 #include <dirent.h>
 23 #include <errno.h>
 24 #include <fcntl.h>
 25
 26 #include <sys/types.h>
 27 #include <sys/stat.h>
 28 #include <sys/types.h>
 29 #include <sys/mman.h>
 30 #include <sys/mount.h>
 31
 32 #include <linux/kdev_t.h>
 33
 34 #define LOG_TAG "Vold"
 35
 36 #include <cutils/log.h>
 37 #include <cutils/properties.h>
 38
 39 #include "Ntfs.h"
 40
 41 static char FSCK_MSDOS_PATH[] = "/system/bin/fsck_msdos";
 42 static char MKDOSFS_PATH[] = "/system/bin/newfs_msdos";
 43 extern "C" int logwrap(int argc, const char **argv, int background);
 44 extern "C" int mount(const char *, const char *, const char *, unsigned long, const void *);
 45
 46 int Ntfs::doMount(const char *fsPath, const char *mountPoint,
 47                  bool ro, bool remount, bool executable,
 48                  int ownerUid, int ownerGid, int permMask, bool createLost) {
 49     int rc;
 50     unsigned long flags;
 51     char mountData[255];
 52
 53     flags = MS_NODEV | MS_NOSUID | MS_DIRSYNC;
54 
 55     flags |= (executable ? 0 : MS_NOEXEC);
 56     flags |= (ro ? MS_RDONLY : 0);
 57     flags |= (remount ? MS_REMOUNT : 0);
 58 
 59     /*
 60      * Note: This is a temporary hack. If the sampling profiler is enabled,
 61      * we make the SD card world-writable so any process can write snapshots.
 62      *
 63      * TODO: Remove this code once we have a drop box in system_server.
 64      */
 65     char value[PROPERTY_VALUE_MAX];
 66     property_get("persist.sampling_profiler", value, "");
 67     if (value[0] == '1') {
 68         SLOGW("The SD card is world-writable because the"
 69             " 'persist.sampling_profiler' system property is set to '1'.");
 70         permMask = 0;
 71     }
 72 
 73     sprintf(mountData,
 74             "utf8,uid=%d,gid=%d,fmask=%o,dmask=%o",
 75             ownerUid, ownerGid, permMask, permMask);
 76 
 77     rc = mount(fsPath, mountPoint, "ntfs", flags, mountData);
 78 
 79     if (rc && errno == EROFS) {
 80         SLOGE("%s appears to be a read only filesystem - retrying mount RO", fsPath);
 81         flags |= MS_RDONLY;
 82         rc = mount(fsPath, mountPoint, "ntfs", flags, mountData);
 83     }
 84 
 85     if (rc == 0 && createLost) {
 86         char *lost_path;
 87         asprintf(&lost_path, "%s/LOST.DIR", mountPoint);
 88         if (access(lost_path, F_OK)) {
 89             /*
 90              * Create a LOST.DIR in the root so we have somewhere to put
 91              * lost cluster chains (fsck_msdos doesn't currently do this)
 92              */
 93             if (mkdir(lost_path, 0755)) {
 94                 SLOGE("Unable to create LOST.DIR (%s)", strerror(errno));
 95             }
 96         }
 97         free(lost_path);
 98     }
 99 
100     return rc;
101 }


Ntfs는 read-only만 지원 됩니다.

shell@android:/ $ mount
rootfs / rootfs ro,relatime 0 0
tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
tmpfs /mnt/secure tmpfs rw,relatime,mode=700 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
/dev/block/mmcblk0p2 /system ext4 ro,relatime,data=ordered 0 0
/dev/block/mmcblk0p4 /cache ext4 rw,nosuid,nodev,noatime,nomblk_io_submit,errors=panic,data=ordered 0 0
/dev/block/mmcblk0p3 /data ext4 rw,nosuid,nodev,noatime,nomblk_io_submit,discard,noauto_da_alloc,errors=panic,data=ordered 0 0
/sys/kernel/debug /sys/kernel/debug debugfs rw,relatime 0 0
/dev/block/vold/179:1 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 00
/dev/block/vold/179:1 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount0
tmpfs /mnt/sdcard/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
/dev/block/vold/179:9 /mnt/ext_sd vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 00
/dev/block/vold/8:1 /storage/usb1 ntfs ro,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,umask=0702,nls=utf8,errors=continue,mft_zone_multiplier=1 0 0
shell@android:/ $ 






2013년 6월 28일 금요일

ODROID + XBox Controller Vs. OUYA



요즘 Hot한 OUYA 입니다.

안드로이드 console 게임기죠.

아래 동영상은 ODROID-X에 XBox Controller를 연결하여 게임 하는 모습니다.



OUYA는 GMS(Google Mobile Service)를 포함하시 않고 자체 Launcher가 있습니다.

혹시나 해서 ODROID에 올려 봤는데 안되더군요.
Launcher에서 서버와 통신하여 뭔가를 확인하도록 되어 있는 것 같습니다.


Google Play store를 공식 지원하지 않는 OUYA에서 현재 게임을 Launcher에서 다운 받는지 어떻게 추가하는지 궁금하네요.

OUYA만의 독점 배포 게임이 아니라면 모든 안드로이드에도 게임들이 동작 할 것이고 ODROID가 현재는 더 나은 퍼포먼스를 보여 주고 있죠.

기회가 되면 OUYA Controller를 ODROID에 연결해서 게임을 해보고 싶네요.

어제 Google에서 Android Console을 만든다는 루머가 있었죠.


Nexus-Q가 다음은 Console로 나올까요?

2013년 6월 26일 수요일

Soft keyboard bug.

android(4.1.2)에서 USB Keyboard를 연결하고 Soft keyboard를 사용하기 위해 Physical Keyboard turn off 하면 한번 software keyboard가 동작하고 물리적 키보드를 off하여도 안되고 재부팅 해도 안되네요.안드로이드 버그 인듯 한데 재부팅해도 안되는 건 좀 심각한 문제 인 듯 합니다.

http://comments.gmane.org/gmane.comp.handhelds.android.devel/219858

1. connect usb keyboard.
2. physical keyboard turn off.
3. run soft keyboard and It works only one time.
4. set physical keyboard.
5. physical keyboard turn off.
6. does not work soft keyboard never when usb keyboard is connected.

해결책은 언어를 바꾸고 바로 Default를 선택하면 나오는 화면에서 바꿀 수 있네요.


I found a solution.Change Language and just select Default item of "KEYBOARD & INPUT METHODS" menu. and you can change state of Hardware(Physical keyboard) on/off.


1. click "Language & input"

2. click "Default"
3. Change state of Hardware(Physical keyboard) on/off.



fix this file
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java


 37 import android.view.inputmethod.InputMethodSubtype;
 38 import android.widget.CompoundButton;
 39 import android.widget.CompoundButton.OnCheckedChangeListener;
 40 import android.widget.ImageView;


141     @Override
142     public void onFinishInflate() {
143         mInputMethodMenuList = (LinearLayout) findViewById(R.id.input_method_menu_list);
144         mHardKeyboardSection = (LinearLayout) findViewById(R.id.hard_keyboard_section);
145         mHardKeyboardSwitch = (Switch) findViewById(R.id.hard_keyboard_switch);
146         mHardKeyboardSwitch.setOnCheckedChangeListener(
147             new OnCheckedChangeListener() {
148             @Override
149             public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
150                 updateHardKeyboardEnabled();
151             }
152         });
153         mConfigureImeShortcut = findViewById(R.id.ime_settings_shortcut);
154         mConfigureImeShortcut.setOnClickListener(this);
155         // TODO: If configurations for IME are not changed, do not update
156         // by checking onConfigurationChanged.
157         updateUiElements();
158     }



2013년 6월 20일 목요일

HDMI screen rotation issue for ODROID(Exynos4412)

for Exynos4412(mali)

1080P(Full HD)

Tumblr.


720P -> enable Portrait HDMI Screen



1080P -> not allow Portrait HDMI Screen.





device/samsung/exynos4/libhdmi/libhdmiservice/SecTVOutService.cpp


291     void SecTVOutService::setHdmiRotate(uint32_t rotVal, uint32_t hwcLayer)
292     {
293         //codewalker
294         // 1080p is spec out.
295         if (mLCD_height == 1080)
296             return;

2013년 6월 19일 수요일

ODROID - Android Beta 1.8.0

1. Include XBox Controller kl, kcm.
2. Enable Netflix service.
3. Fix 1080P HDMI rotation issue.
4. If mouse.right.click property set "back", Mouse right click act back button(esc key).
5. If ro.sf.hwrotation is set, It effect rotation of HDMI Screen.
6. Fix not to root.
7. Mount USB Mass Storage automatically. (http://forum.odroid.com/viewtopic.php?f=14&t=1906&p=14016#p14016)
8. remove ODROID, FileManager, Ternmial app. add jackpal AndroidTerm, Ultra Explorer app.

https://www.dropbox.com/sh/d5zfj5z3mo0rohj/g7utJRzedt

Add init.d support to ODROID

Add init.d support to ODROID

create sysinit script device/hardkernel/proprietary/bin/sysinit

#!/system/bin/sh

export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
/system/bin/logwrapper /system/xbin/run-parts /system/etc/init.d


edit device.mk

# init.d support
PRODUCT_COPY_FILES += \
     device/hardkernel/proprietary/bin/sysinit:system/bin/sysinit


edit init.odroidu2.rc

on boot
# Run sysinit
    start sysinit

...

# sysinit (/system/etc/init.d)
service sysinit /system/bin/sysinit
    user root
    oneshot


build android

why support init.d?

Must do 98netflix script for Netflix service.