2013년 5월 13일 월요일

adb shell sendevent로 pinch zoom in/out

adb shell sendevent로 android에 input event를 가상으로 보낼 수 있습니다.

http://toors.tistory.com/entry/android-touch-move-event-%EC%83%9D%EC%84%B1

위에 링크처럼 하면 move와 같이 single  touch event는 만들 수 있습니다.

pinch zoom in/out과 같은 multi touch event도 만들 수 있습니다.

getevent에서 odroidx-ts가 touch screen device이고 node는 event1입니다.

# getevent                                                    
add device 1: /dev/input/event0                                              
  name:     "odroid-keypad"                                                  
add device 2: /dev/input/event2                                              
  name:     "Microsoft Microsoft 3-Button Mouse with IntelliEye(TM)"          
add device 3: /dev/input/event1                                              
  name:     "odroidx-ts"


저의 시스템에서 touch의 노드는 /dev/input/event3입니다.

sh로 만드실 경우 system을 없애고 "adb shell sendevent"로 고치시면 됩니다.


//첫번째 pointer의 ABS_MT_TRACKING_ID를 1로 설정한다.
system("sendevent /dev/input/event1 3 57 1");
system("sendevent /dev/input/event1 3 53 %d", X1);
system("sendevent /dev/input/event1 3 54 %d", Y1);
//ABS_MT_PRESSURE 8정도의 값을 보내서 press 되었다고 알려 줍니다.
system("sendevent /dev/input/event1 3 58 8");
//한 pointer에 대한 EV_SYN, SYN_REPORT를 보낸다.
system("sendevent /dev/input/event3 0 0 0");


//두번째 pointer 입력 전에 ABS_MT_SLOT을 보낸다.
system("sendevent /dev/input/event3 3 47 1");


//두번째 pointer의 위치를 정한다.
X1 = X2 + 50;
Y2 = Y2 + 50;


//두번째 pointer
//첫번째 pointer의 ABS_MT_TRACKING_ID를 2로 설정한다.
system("sendevent /dev/input/event1 3 57 2");
system("sendevent /dev/input/event1 3 53 %d", X2);
system("sendevent /dev/input/event1 3 54 %d", Y2);  
system("sendevent /dev/input/event1 3 58 8");
system("sendevent /dev/input/event1 0 0 0");


//여기서 ABS_MT_POSITION_X(53), ABS_MT_POSITION_Y(54), 그리고 SYN_REPORT를 한 묶음으로 이동하고 싶은 만큼 반복한다.
system("sendevent /dev/input/event1 3 53 %d", X2 += 20);
system("sendevent /dev/input/event1 3 54 %d", Y2 += 20);
system("sendevent /dev/input/event1 0 0 0");


//첫번째 pointer의 ABS_MT_TR두ACKING_ID를 -1을 초기화 한다.
system("sendevent /dev/input/event1 3 57 -1");
system("sendevent /dev/input/event1 0 0 0");
//ABS_MT_SLOT(47)은 0,1로 번갈아 입력된다. 앞에서 1로 보냈으니 0으로 보낸다.
system("sendevent /dev/input/event1 3 47 0");
//두번째 pointer의 ABS_MT_TRACKING_ID를 -1을 초기화 한다.
system("sendevent /dev/input/event1 3 57 -1");
system("sendevent /dev/input/event1 0 0 0");

--------------------------------------------------------------------------------------------------

bionic/libc/kernel/common/linux/input.h에 define 되어 있습니다.

#define EV_ABS 0x03
#define ABS_MT_POSITION_X 0x35  -> 57(십진수)

#define ABS_MT_POSITION_Y 0x36 - > 58(십진수)
#define ABS_MT_PRESSURE 0x3a



아래와 같이 getevent -l 로 event를 확인 할 수 있는데 Multi touch시에 event가 어떻게 들어 오는지 확인하여 pinch zoom을 구현해 봤습니다.


$ adb shell getevent -l
add device 1: /dev/input/event0
  name:     "odroid-keypad"
add device 2: /dev/input/event2
  name:     "Microsoft Microsoft 3-Button Mouse with IntelliEye(TM)"
add device 3: /dev/input/event1
  name:     "odroidx-ts"
/dev/input/event2: EV_REL       REL_X                ffffffff          
/dev/input/event2: EV_REL       REL_Y                00000001          
/dev/input/event2: EV_SYN       SYN_REPORT           00000000          
/dev/input/event2: EV_REL       REL_X                ffffffff          
/dev/input/event2: EV_REL       REL_Y                00000002          
/dev/input/event2: EV_SYN       SYN_REPORT           00000000          
/dev/input/event2: EV_REL       REL_X                ffffffff          
/dev/input/event2: EV_REL       REL_Y                00000002          
/dev/input/event2: EV_SYN       SYN_REPORT           00000000          
/dev/input/event2: EV_REL       REL_X                ffffffff          
/dev/input/event2: EV_REL       REL_Y                00000002          
/dev/input/event2: EV_SYN       SYN_REPORT           00000000          
/dev/input/event2: EV_REL       REL_X                ffffffff          
/dev/input/event2: EV_REL       REL_Y                00000002          
/dev/input/event2: EV_SYN       SYN_REPORT           00000000          
/dev/input/event2: EV_REL       REL_X                ffffffff          
/dev/input/event2: EV_REL       REL_Y                00000002  




2013년 4월 15일 월요일

Recovery for ODROID

I success to port recovery function of CM to ODROID-X2 base Android beta 1.5(android-4.1.2_r1). 
well working.




now enable recovery UI on LCD.



2013년 4월 2일 화요일

CM-10.1-M2 for ODROID-U2

1. Support Ethernet. (static IP not yet)
2. Mouse right button click act like back Button.
3. add PowerOff widget.



working to enable Volume Up/Down, Screenshot, Power Button.


https://www.dropbox.com/s/sy3lkbo8fr48xla/cm-10.1-20130404-UNOFFICIAL-odroidu2.zip

build and install CyanogenMod for ODOID-U2

http://wiki.cyanogenmod.org/w/Build_for_odroidu2

소스를 git로부터 가져 옵니다.
get source from git.

$repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1

$repo sync

tag를 확인해 보면 M2가 있습니다. M2로 checkout합니다.


[~/projects/cm-10.1/frameworks/base]$ git tag
cm-10.1-M1
cm-10.1-M2

$repo forall -c git chechout cm-10.1-M2

$cd vendor/cm
$./get-prebuilts
$cd ../..

$source build/envsetup.sh
$breakfast odroidu2

including vendor/cm/vendorsetup.sh
ls: cannot access device/*/odroidu2/cm.mk: No such file or directory
build/core/product_config.mk:234: *** Cannot locate config makefile for product "cm_odroidu2".  Stop.
Device odroidu2 not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod).
Found repository: android_device_hardkernel_odroidu2
Default revision: cm-10.1
Checking branch info
Adding dependency: CyanogenMod/android_device_hardkernel_odroidu2 -> device/hardkernel/odroidu2
Using default branch for android_device_hardkernel_odroidu2
Syncing repository to retrieve project.
remote: Counting objects: 338, done.
remote: Compressing objects: 100% (148/148), done.
remote: Total 338 (delta 147), reused 320 (delta 129)
Receiving objects: 100% (338/338), 2.87 MiB | 153 KiB/s, done.
Resolving deltas: 100% (147/147), done.
From git://github.com/CyanogenMod/android_device_hardkernel_odroidu2
 * [new branch]      cm-10.1    -> github/cm-10.1
 * [new tag]         cm-10.1-M2 -> cm-10.1-M2
 * [new tag]         cm-10.1-M3 -> cm-10.1-M3
 * [new tag]         cm-10.1.0-RC1 -> cm-10.1.0-RC1
 * [new tag]         cm-10.1.0-RC2 -> cm-10.1.0-RC2
 * [new tag]         cm-10.1.0-RC3 -> cm-10.1.0-RC3
 * [new tag]         cm-10.1.0-RC4 -> cm-10.1.0-RC4
 * [new tag]         cm-10.1.0-RC5 -> cm-10.1.0-RC5
From git://github.com/CyanogenMod/android_device_hardkernel_odroidu2
 * [new tag]         cm-10.1-M1 -> cm-10.1-M1
Fetching projects: 100% (1/1), done.

Repository synced!
Looking for dependencies
Adding dependencies to manifest
Adding dependency: CyanogenMod/android_device_hardkernel_samsung -> device/hardkernel/samsung
Using default branch for android_device_hardkernel_samsung
Adding dependency: CyanogenMod/android_hardware_realtek -> hardware/realtek
Using default branch for android_hardware_realtek
Adding dependency: CyanogenMod/hardkernel-kernel-4412 -> kernel/hardkernel/4412-common
Using default branch for hardkernel-kernel-4412
Syncing dependencies
remote: Counting objects: 673, done.
remote: Counting objects: 19, done.
remote: Compressing objects: 100% (15/15), done.
remote: Compressing objects: 100% (315/315), done.
remote: Total 19 (delta 0), reused 19 (delta 0)
Unpacking objects: 100% (19/19), done.
From git://github.com/CyanogenMod/android_hardware_realtek
 * [new branch]      cm-10.1    -> github/cm-10.1
 * [new tag]         cm-10.1-M1 -> cm-10.1-M1
 * [new tag]         cm-10.1-M2 -> cm-10.1-M2
 * [new tag]         cm-10.1-M3 -> cm-10.1-M3
 * [new tag]         cm-10.1.0-RC1 -> cm-10.1.0-RC1
 * [new tag]         cm-10.1.0-RC2 -> cm-10.1.0-RC2
 * [new tag]         cm-10.1.0-RC3 -> cm-10.1.0-RC3
 * [new tag]         cm-10.1.0-RC4 -> cm-10.1.0-RC4
 * [new tag]         cm-10.1.0-RC5 -> cm-10.1.0-RC5
remote: Total 673 (delta 326), reused 673 (delta 326)
Receiving objects: 100% (673/673), 3.95 MiB | 94 KiB/s, done.
Resolving deltas: 100% (326/326), done.
From git://github.com/CyanogenMod/android_device_hardkernel_samsung
 * [new branch]      cm-10.1    -> github/cm-10.1
 * [new tag]         cm-10.1-M1 -> cm-10.1-M1
 * [new tag]         cm-10.1-M2 -> cm-10.1-M2
 * [new tag]         cm-10.1-M3 -> cm-10.1-M3
 * [new tag]         cm-10.1-MR1 -> cm-10.1-MR1
 * [new tag]         cm-10.1.0-RC1 -> cm-10.1.0-RC1
 * [new tag]         cm-10.1.0-RC2 -> cm-10.1.0-RC2
 * [new tag]         cm-10.1.0-RC3 -> cm-10.1.0-RC3
 * [new tag]         cm-10.1.0-RC4 -> cm-10.1.0-RC4
 * [new tag]         cm-10.1.0-RC5 -> cm-10.1.0-RC5
remote: Counting objects: 2114829, done.
remote: Compressing objects: 100% (330292/330292), done.
Receiving objects:   2% (43873/2114829), 16.79 MiB | 131 KiB/s  





odroid-u2를 켜고 device/hardkernel/odroidu2/extract-files.sh을 실행

Turn on odroid-u2 and run shell script.

$sh ./extrac-files.sh

And build.

$source build/envsetup.sh
$breakfast odroidu2
$croot
$brunch odroidu2


http://wiki.cyanogenmod.org/w/Install_CM_for_odroidu2

여기서 CM 복구 이미지를 받습니다.
Download CM Recovery(bootstrap) Image.

http://cmw.cmfs.me/emmc/bootstrap-cm-10.1-20130105-odroidu2.zip

압축을 풀고 eMMC를 PC에 연결 합니다.
Unzip and connect eMMC Module to PC.

sh ./install-emmc.sh /dev/sd[x] 와 같이 mount된 eMMC의 sd[x]를 넣어 줍니다.


[~/Downloads/cyanogenMod]$ sh ./install-emmc.sh /dev/sdd
/dev/sdd reader is identified.
Fusing kernel
2887260+0 records in
2887260+0 records out
2887260 bytes (2.9 MB) copied, 2.15934 s, 1.3 MB/s
Fusing root filesystem
185013+0 records in
185013+0 records out
185013 bytes (185 kB) copied, 0.203257 s, 910 kB/s
Fusing main system partition
500+0 records in
500+0 records out
524288000 bytes (524 MB) copied, 37.0214 s, 14.2 MB/s



eMMC를 다시 PC에 연결 후 fat 영역에 "cmupdater" 란 폴더를 만들고 cm-10.1-xxxxxxxx-UNOFFICIAL-odroidu2.zip 앞에서 build된 zip 파일을 넣으면 아래와 같이 보이고 설치가 가능합니다.

finished fusing, reconnect eMMC module.

make directory "cmupdater" into fat partition.

copy cm-10.1-xxxxxxxx-UNOFFICIAL-odroidu2.zip.



2013년 3월 25일 월요일

GMS apps install without PC for ODROID

Connect USB Keyboard.

1. Download GAPPS from Broswer









http://goo.im/gapps/


ICS

gapps-ics-20120429-signed.zip

JB

gapps-jb-20121011-signed.zip

2. Run File Explorer




3. Unzip by File Explorer app.

  






4. Run Terminal 





5. get Root

#su




6. remount /system patition to rw

#mount -o rw,remount /system


root@android:/sdcard/Download # 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/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 rw,relatime,barrier=1,data=ordered 0 0        
/dev/block/mmcblk0p3 /data ext4 rw,nosuid,nodev,noatime,barrier=1,nodelalloc,da0
/dev/block/mmcblk0p4 /cache ext4 rw,nosuid,nodev,noatime,barrier=1,nomblk_io_su0
none /proc/bus/usb usbfs rw,relatime,devmode=666 0 0                            
/dev/block/vold/179:1 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,relatime,0
/dev/block/vold/179:1 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,rela0
tmpfs /mnt/sdcard/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0        
root@android:/sdcard/Download # 

7. cp gapps files


/system/bin/busybox cp -rv /sdcard/Download/gapp-jb-20121011-signed/system/* /system/


8. change permissions


#cd /system/app
#chmod 644 *
#sync
#reboot

9. finish











2013년 1월 28일 월요일

Makefile에서 "-=" 문제

android 4.1.1에서 busybox가 컴파일이 안된다.
문제는 -fno-strict-volatile-bitfields다.
4.2.1에서는 컴파일이 되는데 4.1.1에서는 안된다.

build/core/combo/TARGET_linux-arm.mk


120 # by turning off the builtin sin function.                          
121 ifneq ($(filter 4.6.%, $(shell $(TARGET_CC) --version)),)          
122 TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable -fno-builtin-sin \
123             -fno-strict-volatile-bitfields                                                          
124 endif                                                                  
125        


그래서 저 옵션만 끄면 되것 같아서 아래와 같이 해 보았다.

TARGET_GLOBAL_CFLAGS -= -fno-strict-volatile-bitfields

물론 -=가 될줄 알았는데 안된다.

그래서 할 수 없이 TARGET_GLOBAL_CFLAGS에서 -fno-strict-volatile-bitfields를 없애고 다른 변수를 선언하기로 했다.

TARGET_GLOBAL_CFLAGS2 := $(shell echo $(TARGET_GLOBAL_CFLAGS) | sed 's/-fno-strict-volatile-bitfields/ /g')