일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
- fujifilm velvia 50
- Kodak 5222
- Mamiya 7
- cs50/2.5
- cf80/2.8
- FujiFilm GFX50s
- 2018 미국출장
- Kodak T-Max 100
- Kodak Ektar 100
- kodak t-max 400
- Kodak 400TX
- Germany
- Leica M7
- 4870
- Rollei35s
- Minolta TC-1
- N80/4
- ZeissIkon ZI
- GRD2
- Hasselblad 500cm
- Minolta CLE
- Nikon 28Ti
- SONY A7
- M-Rokkor 40/2
- G28/2.8
- Contax G2
- cf50/4 fle
- 2019 유럽여행
- FujiFilm C200
- Kentmere 400
- Today
- Total
J 창고
[Android] Emulator 환경에서 USB Host 기능 사용하기 본문
1. 개요
Android Device에 USB-Serial 을 통해 Device를 연동해야 하는데 이때 Android Emulator 환경에서 테스트 할 수 있는 방법이 있어 공유해 본다.
Android Emulator를 동작시키는 QEMU의 USB passthrough 기능을 통하여 VID:PID USB Device를 Android USB-Host와 연동할 수 있다.
Android 10 기준으로 작성하였으며 USB passthrough 기능은 Linux Host에서만 지원한다.
(최근 Release 된 ChangeNote에 Windows 도 지원 된다고 명시되어 있으나 문제가 있는지 Revert 되었다)
2. 설정
2.1 Android Studio 설치
https://developer.android.com/studio#downloads
2.2 Setup SDK and make Android AVDs device1) Initial setup
1) Initial setup
2) Run AVD Manager
3) Create AVD Device
3-1) Select AVD Device “Pixel 3a”
3-2) Select Android Q(x86_64 / Android 10.0 (Google APIs) )
do not select “Android 10.0 (Google Play)
3-3) Download Android Q(X86_64) images
2.3 Run Android Emulator via command line
1) Go to Android Emuator Root
cd /PATH/TO/ANDROID/SDK/ROOT/Android/Sdk/emulator
2) Excute Command
./emulator @Pixel_3a_API_29 -writable-system -show-kernel -verbose -qemu -device usb-ehci,id=ehci -device usb-host,bus=ehci.0,vendorid=${USBVID},productid=${USBPID}
2.4 Make permissions to connect usb device as host
1) disable verification
adb root
adb shell avbctl disable-verification
adb disable-verity
adb reboot
2) remount
adb root
adb remount
adb shell
3) write permission (in android)
echo '<permissions><feature name="android.hardware.usb.host"/></permissions>' > /system/etc/permissions/android.hardware.usb.host.xml
echo '<permissions> <feature name="android.hardware.usb.accessory" /> <library name="com.android.future.usb.accessory" file="/system/framework/com.android.future.usb.accessory.jar" /> </permissions>' > /system/etc/permissions/android.hardware.usb.accessory.xml
exit
4) reboot
adb reboot
2.5 Check usb connection is working
아래와 같이 VID/PID를 명시한 Device가 인식된 것을 확인할 수 있다.
3. Reference
https://source.android.com/devices/automotive/start/passthrough
https://gist.github.com/Alabate/200f021e644baed84993dd6109811ba2