본문 바로가기
안드로이드

안드로이드 커스텀 리모컨 키값 프로필 생성하기

by 도정진 ㅋㅋ잠자 2019. 8. 4.

안녕하세요? 


아래의 LG 리모컨을 활용해 보기 위해서 키값을 생성해보고 있습니다.







1. 리모컨 특징


앞면 뒷면 존재 뒷면에 풀 키보드 및 마우스 패드 존재


이어폰 기능 마이크 기능 존재


블루투스 페어링 시 키 페어링 이어폰 페어링 단계 있음


그런데 살짝 키반응은 느린편입니다 ㅎㅎㅎ..


<페어링 방법>

우측 아래 지우기 버튼 꾹 누르고 리모컨 초기화

가운데 U+ 메뉴 꾹 눌러 페어링 모드 진입

BT RCU 먼저 페어링

EARSET 페어링


페어링 후 아래의 2개 장비가 페어링 되어야합니다.






2. 안드로이드 키 값 프로파일 작성


이전에 볼륨 키 고장나서 홈키를 볼륨키로 쓴다거나 할 때.. /system/usr/keylayout/qwerty.kl 파일을 수정해 보신적이 있으실 껍니다. 그 방법을 활용하여 작성해 보는 것입니다.


root@AOL-Debian:/system/usr/keylayout# ls

AVRCP.kl      Vendor_046d_Product_c299.kl  Vendor_18d1_Product_2c40.kl

Generic.kl      Vendor_046d_Product_c532.kl  Vendor_18d1_Product_5018.kl

qwerty.kl      Vendor_054c_Product_0268.kl  Vendor_1949_Product_0401.kl

Vendor_0079_Product_0011.kl  Vendor_0583_Product_2060.kl  Vendor_1bad_Product_f016.kl

Vendor_045e_Product_028e.kl  Vendor_05ac_Product_0239.kl  Vendor_1bad_Product_f023.kl

Vendor_045e_Product_02d1.kl  Vendor_0b05_Product_4500.kl  Vendor_1bad_Product_f027.kl

Vendor_046d_Product_b501.kl  Vendor_1038_Product_1412.kl  Vendor_1bad_Product_f036.kl

Vendor_046d_Product_c216.kl  Vendor_12bd_Product_d015.kl  Vendor_1d79_Product_0009.kl

Vendor_046d_Product_c219.kl  Vendor_1532_Product_0900.kl  Vendor_22b8_Product_093d.kl

Vendor_046d_Product_c21d.kl  Vendor_1689_Product_fd00.kl  Vendor_2378_Product_1008.kl

Vendor_046d_Product_c21f.kl  Vendor_1689_Product_fd01.kl  Vendor_2378_Product_100a.kl

Vendor_046d_Product_c294.kl  Vendor_1689_Product_fe00.kl


내용을 보면 아래와 같습니다.


root@AOL-Debian:/system/usr/keylayout# cat AVRCP.kl 

# Copyright (C) 2010 The Android Open Source Project

#

# Licensed under the Apache License, Version 2.0 (the "License");

# you may not use this file except in compliance with the License.

# You may obtain a copy of the License at

#

#      http://www.apache.org/licenses/LICENSE-2.0

#

# Unless required by applicable law or agreed to in writing, software

# distributed under the License is distributed on an "AS IS" BASIS,

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

# See the License for the specific language governing permissions and

# limitations under the License.


# Key layout used for Bluetooth AVRCP support.


key 200   MEDIA_PLAY

key 201   MEDIA_PAUSE

key 166   MEDIA_STOP

key 163   MEDIA_NEXT

key 165   MEDIA_PREVIOUS

key 168   MEDIA_REWIND

key 208   MEDIA_FAST_FORWARD


AVRCP 는 블루투스 이어폰의 버튼 값을 나타내고 있습니다. 이걸 참고하여 작성해야하는데..


Vendor_046d_Product_c294.kl <-- 아니 벤더 프로덕트 이걸 어디서 찾는지 모르겠습니다.


그럼 /proc 을 뒤져서 찾아봐야합니다.


root@AOL-Debian:/system/usr/keylayout# cat /proc/bus/input/devices

I: Bus=0010 Vendor=0001 Product=0001 Version=0100

N: Name="aml_keypad"

P: Phys=keypad/input0

S: Sysfs=/devices/platform/ff808040.rc/input/input0

U: Uniq=

H: Handlers=kbd mouse0 event0 

B: PROP=0

B: EV=7

B: KEY=ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 0 0 70000 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe

B: REL=103


I: Bus=0010 Vendor=1b8e Product=0cec Version=0001

N: Name="cec_input"

P: Phys=

S: Sysfs=/devices/virtual/input/input1

U: Uniq=

H: Handlers=kbd event1 

B: PROP=0

B: EV=3

B: KEY=1 0 0 0 0 100000 0 0 0


I: Bus=0003 Vendor=2319 Product=00b2 Version=0200

N: Name="InnSpire Intelligent Hotels USB Dongle"

P: Phys=usb-xhci-hcd.0.auto-2/input2

S: Sysfs=/devices/platform/ff500000.dwc3/xhci-hcd.0.auto/usb1/1-2/1-2:1.2/0003:2319:00B2.0001/input/input2

U: Uniq=

H: Handlers=kbd mouse1 event2 

B: PROP=0

B: EV=1f

B: KEY=3007f 0 0 0 0 483ffff 17aff32d bf544446 0 0 70001 130f93 8b17c000 677bfa d941dfed 9ed680 4400 0 10000002

B: REL=ff43

B: ABS=1 0

B: MSC=10


I: Bus=0003 Vendor=2319 Product=00b2 Version=0200

N: Name="InnSpire Intelligent Hotels USB Dongle"

P: Phys=usb-xhci-hcd.0.auto-2/input3

S: Sysfs=/devices/platform/ff500000.dwc3/xhci-hcd.0.auto/usb1/1-2/1-2:1.3/0003:2319:00B2.0002/input/input3

U: Uniq=

H: Handlers=kbd leds event3 

B: PROP=0

B: EV=120013

B: KEY=10000 7 ff9f207a c14057ff febeffdf ffefffff ffffffff fffffffe

B: MSC=10

B: LED=7


I: Bus=0005 Vendor=00c4 Product=0080 Version=0213

N: Name="LGU tvG2 RCU"

P: Phys=

S: Sysfs=/devices/virtual/misc/uhid/0005:00C4:0080.0003/input/input4

U: Uniq=F8:13:F6:8B:08:8C

H: Handlers=kbd leds mouse2 event4 

B: PROP=0

B: EV=12001f

B: KEY=3f 3007f 0 0 0 0 483ffff 17aff32d bf544446 0 0 70001 130f93 8b17c007 ffff7bfa d9415fff febeffdf ffefffff ffffffff fffffffe

B: REL=143

B: ABS=1 0

B: MSC=10

B: LED=1f


Vendor_00c4_Product_0080_Version_0213.kl 이런식으로 파일 이름을 작성하시면 됩니다.


대부분 버전은 빼고 넣습니다.


자 그럼 키 값은 어떻게 찾느냐..


일단 evtest 를 설치하고 /dev/input 으로 이동하여 이벤트가 몇개 있는지 봅니다. 그리고 cat eventX 하여 버튼을 누를때마다 반응하는 것이 있을 것입니다.


root@AOL-Debian:~# apt install evtest

Reading package lists... Done

Building dependency tree       

Reading state information... Done

The following additional packages will be installed:

  evemu-tools libevdev2 libevemu3

The following NEW packages will be installed:

  evemu-tools evtest libevdev2 libevemu3

0 upgraded, 4 newly installed, 0 to remove and 22 not upgraded.

Need to get 63.9 kB of archives.

After this operation, 230 kB of additional disk space will be used.

Do you want to continue? [Y/n] 


root@AOL-Debian:/dev/input# ls

event0 event1 event2 event3 event4 mice  mouse0  mouse1  mouse2

root@AOL-Debian:/dev/input# cat event4

淆]]淆]L淆]淆][_]淆][_L淆][_淆]¬]淆]¬L淆]¬淆]I]淆]IL淆]IXshellXshellXshell


root@AOL-Debian:/dev/input# evtest event4

Input driver version is 1.0.1

Input device ID: bus 0x5 vendor 0xc4 product 0x80 version 0x213

Input device name: "LGU tvG2 RCU"

Supported events:

  Event type 0 (EV_SYN)

  Event type 1 (EV_KEY)

    Event code 1 (KEY_ESC)

    Event code 2 (KEY_1)

    Event code 3 (KEY_2)

    Event code 4 (KEY_3)

    Event code 5 (KEY_4)

    Event code 6 (KEY_5)

    Event code 7 (KEY_6)

    Event code 8 (KEY_7)

    Event code 9 (KEY_8)

    Event code 10 (KEY_9)

    Event code 11 (KEY_0)

    Event code 12 (KEY_MINUS)

    Event code 13 (KEY_EQUAL)

    Event code 14 (KEY_BACKSPACE)

    Event code 15 (KEY_TAB)

    Event code 16 (KEY_Q)

    Event code 17 (KEY_W)

    Event code 18 (KEY_E)

    Event code 19 (KEY_R)

    Event code 20 (KEY_T)

    Event code 21 (KEY_Y)

    Event code 22 (KEY_U)

    Event code 23 (KEY_I)

    Event code 24 (KEY_O)

    Event code 25 (KEY_P)

    Event code 26 (KEY_LEFTBRACE)

    Event code 27 (KEY_RIGHTBRACE)

    Event code 28 (KEY_ENTER)

    Event code 29 (KEY_LEFTCTRL)

    Event code 30 (KEY_A)

    Event code 31 (KEY_S)

    Event code 32 (KEY_D)

    Event code 33 (KEY_F)

    Event code 34 (KEY_G)

    Event code 35 (KEY_H)

    Event code 36 (KEY_J)

    Event code 37 (KEY_K)

    Event code 38 (KEY_L)

    Event code 39 (KEY_SEMICOLON)

    Event code 40 (KEY_APOSTROPHE)

    Event code 41 (KEY_GRAVE)

    Event code 42 (KEY_LEFTSHIFT)

    Event code 43 (KEY_BACKSLASH)

    Event code 44 (KEY_Z)

    Event code 45 (KEY_X)

    Event code 46 (KEY_C)

    Event code 47 (KEY_V)

    Event code 48 (KEY_B)

    Event code 49 (KEY_N)

    Event code 50 (KEY_M)

    Event code 51 (KEY_COMMA)

    Event code 52 (KEY_DOT)

    Event code 53 (KEY_SLASH)

    Event code 54 (KEY_RIGHTSHIFT)

    Event code 55 (KEY_KPASTERISK)

    Event code 56 (KEY_LEFTALT)

    Event code 57 (KEY_SPACE)

    Event code 58 (KEY_CAPSLOCK)

    Event code 59 (KEY_F1)

    Event code 60 (KEY_F2)

    Event code 61 (KEY_F3)

    Event code 62 (KEY_F4)

    Event code 63 (KEY_F5)

    Event code 64 (KEY_F6)

    Event code 65 (KEY_F7)

    Event code 66 (KEY_F8)

    Event code 67 (KEY_F9)

    Event code 68 (KEY_F10)

    Event code 69 (KEY_NUMLOCK)

    Event code 70 (KEY_SCROLLLOCK)

    Event code 71 (KEY_KP7)

    Event code 72 (KEY_KP8)

    Event code 73 (KEY_KP9)

    Event code 74 (KEY_KPMINUS)

    Event code 75 (KEY_KP4)

    Event code 76 (KEY_KP5)

    Event code 77 (KEY_KP6)

    Event code 78 (KEY_KPPLUS)

    Event code 79 (KEY_KP1)

    Event code 80 (KEY_KP2)

    Event code 81 (KEY_KP3)

    Event code 82 (KEY_KP0)

    Event code 83 (KEY_KPDOT)

    Event code 85 (KEY_ZENKAKUHANKAKU)

    Event code 86 (KEY_102ND)

    Event code 87 (KEY_F11)

    Event code 88 (KEY_F12)

    Event code 89 (KEY_RO)

    Event code 90 (KEY_KATAKANA)

    Event code 91 (KEY_HIRAGANA)

    Event code 92 (KEY_HENKAN)

    Event code 93 (KEY_KATAKANAHIRAGANA)

    Event code 94 (KEY_MUHENKAN)

    Event code 95 (KEY_KPJPCOMMA)

    Event code 96 (KEY_KPENTER)

    Event code 97 (KEY_RIGHTCTRL)

    Event code 98 (KEY_KPSLASH)

    Event code 99 (KEY_SYSRQ)

    Event code 100 (KEY_RIGHTALT)

    Event code 102 (KEY_HOME)

    Event code 103 (KEY_UP)

    Event code 104 (KEY_PAGEUP)

    Event code 105 (KEY_LEFT)

    Event code 106 (KEY_RIGHT)

    Event code 107 (KEY_END)

    Event code 108 (KEY_DOWN)

    Event code 109 (KEY_PAGEDOWN)

    Event code 110 (KEY_INSERT)

    Event code 111 (KEY_DELETE)

    Event code 113 (KEY_MUTE)

    Event code 114 (KEY_VOLUMEDOWN)

    Event code 115 (KEY_VOLUMEUP)

    Event code 116 (KEY_POWER)

    Event code 117 (KEY_KPEQUAL)

    Event code 119 (KEY_PAUSE)

    Event code 121 (KEY_KPCOMMA)

    Event code 122 (KEY_HANGUEL)

    Event code 123 (KEY_HANJA)

    Event code 124 (KEY_YEN)

    Event code 125 (KEY_LEFTMETA)

    Event code 126 (KEY_RIGHTMETA)

    Event code 127 (KEY_COMPOSE)

    Event code 128 (KEY_STOP)

    Event code 129 (KEY_AGAIN)

    Event code 130 (KEY_PROPS)

    Event code 131 (KEY_UNDO)

    Event code 132 (KEY_FRONT)

    Event code 133 (KEY_COPY)

    Event code 134 (KEY_OPEN)

    Event code 135 (KEY_PASTE)

    Event code 136 (KEY_FIND)

    Event code 137 (KEY_CUT)

    Event code 138 (KEY_HELP)

    Event code 139 (KEY_MENU)

    Event code 140 (KEY_CALC)

    Event code 142 (KEY_SLEEP)

    Event code 144 (KEY_FILE)

    Event code 150 (KEY_WWW)

    Event code 152 (KEY_SCREENLOCK)

    Event code 155 (KEY_MAIL)

    Event code 156 (KEY_BOOKMARKS)

    Event code 158 (KEY_BACK)

    Event code 159 (KEY_FORWARD)

    Event code 161 (KEY_EJECTCD)

    Event code 163 (KEY_NEXTSONG)

    Event code 164 (KEY_PLAYPAUSE)

    Event code 165 (KEY_PREVIOUSSONG)

    Event code 166 (KEY_STOPCD)

    Event code 167 (KEY_RECORD)

    Event code 168 (KEY_REWIND)

    Event code 169 (KEY_PHONE)

    Event code 171 (KEY_CONFIG)

    Event code 172 (KEY_HOMEPAGE)

    Event code 173 (KEY_REFRESH)

    Event code 174 (KEY_EXIT)

    Event code 176 (KEY_EDIT)

    Event code 177 (KEY_SCROLLUP)

    Event code 178 (KEY_SCROLLDOWN)

    Event code 179 (KEY_KPLEFTPAREN)

    Event code 180 (KEY_KPRIGHTPAREN)

    Event code 181 (KEY_NEW)

    Event code 182 (KEY_REDO)

    Event code 183 (KEY_F13)

    Event code 184 (KEY_F14)

    Event code 185 (KEY_F15)

    Event code 186 (KEY_F16)

    Event code 187 (KEY_F17)

    Event code 188 (KEY_F18)

    Event code 189 (KEY_F19)

    Event code 190 (KEY_F20)

    Event code 191 (KEY_F21)

    Event code 192 (KEY_F22)

    Event code 193 (KEY_F23)

    Event code 194 (KEY_F24)

    Event code 206 (KEY_CLOSE)

    Event code 207 (KEY_PLAY)

    Event code 208 (KEY_FASTFORWARD)

    Event code 209 (KEY_BASSBOOST)

    Event code 210 (KEY_PRINT)

    Event code 212 (KEY_CAMERA)

    Event code 216 (KEY_CHAT)

    Event code 217 (KEY_SEARCH)

    Event code 219 (KEY_FINANCE)

    Event code 223 (KEY_CANCEL)

    Event code 224 (KEY_BRIGHTNESSDOWN)

    Event code 225 (KEY_BRIGHTNESSUP)

    Event code 228 (KEY_KBDILLUMTOGGLE)

    Event code 231 (KEY_SEND)

    Event code 232 (KEY_REPLY)

    Event code 233 (KEY_FORWARDMAIL)

    Event code 234 (KEY_SAVE)

    Event code 235 (KEY_DOCUMENTS)

    Event code 240 (KEY_UNKNOWN)

    Event code 241 (KEY_VIDEO_NEXT)

    Event code 244 (KEY_BRIGHTNESS_ZERO)

    Event code 256 (BTN_0)

    Event code 272 (BTN_LEFT)

    Event code 273 (BTN_RIGHT)

    Event code 274 (BTN_MIDDLE)

    Event code 353 (KEY_SELECT)

    Event code 354 (KEY_GOTO)

    Event code 358 (KEY_INFO)

    Event code 362 (KEY_PROGRAM)

    Event code 366 (KEY_PVR)

    Event code 370 (KEY_SUBTITLE)

    Event code 372 (KEY_ZOOM)

    Event code 374 (KEY_KEYBOARD)

    Event code 376 (KEY_PC)

    Event code 377 (KEY_TV)

    Event code 378 (KEY_TV2)

    Event code 379 (KEY_VCR)

    Event code 380 (KEY_VCR2)

    Event code 381 (KEY_SAT)

    Event code 383 (KEY_CD)

    Event code 384 (KEY_TAPE)

    Event code 386 (KEY_TUNER)

    Event code 387 (KEY_PLAYER)

    Event code 389 (KEY_DVD)

    Event code 392 (KEY_AUDIO)

    Event code 393 (KEY_VIDEO)

    Event code 396 (KEY_MEMO)

    Event code 397 (KEY_CALENDAR)

    Event code 398 (KEY_RED)

    Event code 399 (KEY_GREEN)

    Event code 400 (KEY_YELLOW)

    Event code 401 (KEY_BLUE)

    Event code 402 (KEY_CHANNELUP)

    Event code 403 (KEY_CHANNELDOWN)

    Event code 405 (KEY_LAST)

    Event code 407 (KEY_NEXT)

    Event code 408 (KEY_RESTART)

    Event code 409 (KEY_SLOW)

    Event code 410 (KEY_SHUFFLE)

    Event code 412 (KEY_PREVIOUS)

    Event code 416 (KEY_VIDEOPHONE)

    Event code 417 (KEY_GAMES)

    Event code 418 (KEY_ZOOMIN)

    Event code 419 (KEY_ZOOMOUT)

    Event code 420 (KEY_ZOOMRESET)

    Event code 421 (KEY_WORDPROCESSOR)

    Event code 422 (KEY_EDITOR)

    Event code 423 (KEY_SPREADSHEET)

    Event code 424 (KEY_GRAPHICSEDITOR)

    Event code 425 (KEY_PRESENTATION)

    Event code 426 (KEY_DATABASE)

    Event code 427 (KEY_NEWS)

    Event code 428 (KEY_VOICEMAIL)

    Event code 429 (KEY_ADDRESSBOOK)

    Event code 430 (KEY_MESSENGER)

    Event code 431 (KEY_DISPLAYTOGGLE)

    Event code 432 (KEY_SPELLCHECK)

    Event code 433 (KEY_LOGOFF)

    Event code 439 (KEY_MEDIA_REPEAT)

    Event code 442 (KEY_IMAGES)

    Event code 576 (KEY_BUTTONCONFIG)

    Event code 577 (KEY_TASKMANAGER)

    Event code 578 (KEY_JOURNAL)

    Event code 579 (KEY_CONTROLPANEL)

    Event code 580 (KEY_APPSELECT)

    Event code 581 (KEY_SCREENSAVER)

    Event code 582 (KEY_VOICECOMMAND)

    Event code 592 (KEY_BRIGHTNESS_MIN)

    Event code 593 (KEY_BRIGHTNESS_MAX)

    Event code 608 (KEY_KBDINPUTASSIST_PREV)

    Event code 609 (KEY_KBDINPUTASSIST_NEXT)

    Event code 610 (KEY_KBDINPUTASSIST_PREVGROUP)

    Event code 611 (KEY_KBDINPUTASSIST_NEXTGROUP)

    Event code 612 (KEY_KBDINPUTASSIST_ACCEPT)

    Event code 613 (KEY_KBDINPUTASSIST_CANCEL)

  Event type 2 (EV_REL)

    Event code 0 (REL_X)

    Event code 1 (REL_Y)

    Event code 6 (REL_HWHEEL)

    Event code 8 (REL_WHEEL)

  Event type 3 (EV_ABS)

    Event code 32 (ABS_VOLUME)

      Value      0

      Min        1

      Max      767

  Event type 4 (EV_MSC)

    Event code 4 (MSC_SCAN)

  Event type 17 (EV_LED)

    Event code 0 (LED_NUML) state 0

    Event code 1 (LED_CAPSL) state 0

    Event code 2 (LED_SCROLLL) state 0

    Event code 3 (LED_COMPOSE) state 0

    Event code 4 (LED_KANA) state 0

Key repeat handling:

  Repeat type 20 (EV_REP)

    Repeat code 0 (REP_DELAY)

      Value      0

    Repeat code 1 (REP_PERIOD)

      Value      0

Properties:

Testing ... (interrupt to exit)

Event: time 1564899620.880974, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0042

Event: time 1564899620.880974, type 1 (EV_KEY), code 103 (KEY_UP), value 1

Event: time 1564899620.880974, -------------- SYN_REPORT ------------

Event: time 1564899621.050974, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0042

Event: time 1564899621.050974, type 1 (EV_KEY), code 103 (KEY_UP), value 0

Event: time 1564899621.050974, -------------- SYN_REPORT ------------

Event: time 1564899621.741180, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0042

Event: time 1564899621.741180, type 1 (EV_KEY), code 103 (KEY_UP), value 1

Event: time 1564899621.741180, -------------- SYN_REPORT ------------

Event: time 1564899621.861015, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0042

Event: time 1564899621.861015, type 1 (EV_KEY), code 103 (KEY_UP), value 0

Event: time 1564899621.861015, -------------- SYN_REPORT ------------

Event: time 1564899623.871023, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70059

Event: time 1564899623.871023, type 1 (EV_KEY), code 79 (KEY_KP1), value 1

Event: time 1564899623.871023, -------------- SYN_REPORT ------------

Event: time 1564899624.111266, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70059

Event: time 1564899624.111266, type 1 (EV_KEY), code 79 (KEY_KP1), value 0

Event: time 1564899624.111266, -------------- SYN_REPORT ------------

Event: time 1564899624.751030, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7005a

Event: time 1564899624.751030, type 1 (EV_KEY), code 80 (KEY_KP2), value 1

Event: time 1564899624.751030, -------------- SYN_REPORT ------------

Event: time 1564899624.881061, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7005a

Event: time 1564899624.881061, type 1 (EV_KEY), code 80 (KEY_KP2), value 0

Event: time 1564899624.881061, -------------- SYN_REPORT ------------


evtest 로 키 값 리스트와 눌러보면서 키값을 찾으실 수 있습니다.


그럼 Generic.kl 파일을 가져와서 수정 후 Vendor_00c4_Product_0080_Version_0213.kl 로 만들어 넣어주면 됩니다.





3. LG RCU 키값 작성...


다음에... 제작 후 과정 공개합니당..








댓글0