Apple iPod Remote Control Protocol

31395 
Created at 2007-02-06 19:53:09 
135   0   0   0  

세상에는 벼래별 희안한 사람들이 다 있다.


iPOD를 해킹해서 소스코드까지 만들어내는 훌륭한 사람들... 쿠쿵!!

I reverse-engineered a second-generation iPod remote (theversion that has the touch-sensitive scroll wheel). The remote probablyworks exactly as-is with the first generation iPod (with the mechanicalscroll wheel). The newest third-generation ipods (thinner, rounder, andwith 4 buttons in-line)have a similar remote with an identical circuit board, but with adifferent square 4-pin remote connector-- the new pinout hasn't been completely figured out, and it's notknown if the same protocol is used.
 
 




Remote is labeled "MITSUMI" and "66-6616A". The cable has 6 pins: 3analog signals are fed directly to the headphone jack, 3 go to a smallmicrocontroller and handle the remote-control functions. To reducenoise,they do not share a common ground in the remote (but I can still heartheremote affecting the sound).

Disassembly
The shiny exterior that looks like shiny metal really is - don't tryto bend it! I thought it was just a metalized plastic, but it's nice tosee such a nice quality case. I first considered this a cover thatcouldbe snapped off, but it's really the body of the remote; remove thewhiteplastic portion - the clip and back of the remote - by prying it out ofthe metal case by "b" in the phrase "assembled in china". The pcboard (including the headphone jack) will remain in the case. Probablythe easiest way to remove the plastic is to slip a thin screwdriver onthe same side as the hold switch, just past the green dot (away fromtheswitch, not on top of it). A picture would be helpful, but I haven'ttriedto put it back together yet - that looks like a challenge. There aretwopins in the metal case that hold the pc board; these don't bend andmake removing the pc board somewhat difficult.

Pinout
The generation 2 remote connector is compatible with standard 1/8thinch headphonejack, and also looks like the same connector used in the iBook AV cable(no confirmation on this, though).
It contains six unshielded wires, whichare soldered to the PC board.

morganw has kindly provided the information (and pictures) of thegeneration 3 connector. All of the remote functionality has been movedto a unique 4-pin square connector, and two additional contacts mayhave new signals on them.


Generation 2

Generation 3
medium size
medium size, color-coded
large size (100kB)

I'd love to see this
in a gallery!

largesize (100 kB)

These connectors
are so photogenic!


Connections

WireColor
Generation2
 Generation 3 
Signal
blackTip
Tip
Audio, left
whiteRing (Next-to-tip)
Ring
Audio, right
redRing 2 (3rd ring from end)
Ring 2
Audio ground
greenSleeve (4th ring from end)
pin 1
Data to iPod
blueinner ring
pin 4
Power to remote, +3.3v
yellowoutermost ring
pin 3
Digital ground


pin 2
no connect / unknown


Sleeve
no connect / unknown


Generation 3

The third generation iPod seems to use the same remote (internally andexternally) as the second generation, but with adifferent connector. It's still unknown if the microcontroller containsdifferent firmware (and so it may use a different protocol). Here's apicture of morganw's remote:


largesize (400 kB)

Remote Control IC

The remote uses a general-purpose Microchip 12C508A microcontroller (datasheet):

medium size
large size (100kB)
The chip has 8 pins: 2 for power, 6 are general purpose I/O. Reset anda 4 MHzoscillator are internal to the chip. It runs on 3.0 - 5.5 volts and has512 words of program memory, 25 bytes of RAM, and a 1 microsecondinstructiontime. The only peripheral (other than I/O) is a timer. This may beused,but it appears that the external clock on pin 5 (T0CKI) is used as ageneralpurpose I/O.

Two other unpopulated 5-pin IC's (IC2 and IC3) are on the buttonsideof the PCB; not sure what the purpose of these would be.

Schematic

I didn't trace the whole button-side of the schematic, but the rest ofit is pretty simple. Because we have the datasheet of themicrocontroller, the data output (TP7) and power(TP1) connections are well defined electrically.

Testpoints:
TP1 = IC1 pin 1, VDD (3.3v), connected to blue wire.
TP2 = (pulled up to VDD by R3)
TP3 = (pulled up to VDD by R2)
TP4 = SW2 (pulled up to VDD by R1)
TP5 = IC1 pin 5 (pulled up to VDD by R5)
TP6 = IC1 pin 6 (pulled up to VDD by R4)
TP7 = IC1 pin 7. Connected via 1K ohm resistor R7 to the green wire,the data out to the iPod.
TP8 = IC1 pin 8, VSS (ground), connected to yellow wire.
TP9 = [probably hold switch, SW1] (pulled up to VDD by R6)

IC2 (unpopulated) - connects to SW2 & SW4
IC3 (unpopulated) - connects to TP5, SW5

Communications Protocol
Electrical:
digital CMOS output (low = 0v, high = 3.3v) through a 1K ohm resistor,normally low.

Logical:
I've only measured the second generation protocol. I assume the 3rdgeneration is the same, but the code in the processor could be totallydifferent.

I measured about 108.75 uSec/bit, but my equipment wasn't the mostcapable; 9600 baud is 104 uSec/bit and it's a safe bet that this isactuallywhat's used, and jives with other peoples' measurements. Also, sincethemicrocontroller relies on an RC oscillator, it won't be totallyspot-on.My measurement could also have been messed up by a non-integral bittimebetween words (which I couldn't detect too well).

Upon pressing the button, the output goes high for about 45msec andthen sends the first version of the code. This high signal is probablyused to wake the iPod when sleeping.  After that, the remoterepeatsa pattern of waiting about 26msec with a low output, and then sendingthesecond version of the pattern (4msec), until the button is released. Iwasn't able to see if something different happened when the button wasreleased.

The first version of the code (transmitted when button is firstpressed)is:

(....1111) 01111111111 01011111111 0xxx01111111(0000....)

where the xxx depends on which button is pressed.  The secondversionof the code follows this format:

(....0000) 1111 01111111111 01011111111 0xxx01111111 (0000....)

where xxx depends on the button:




VOL+SW6010
VOL-SW2110
SKIP>>SW3001
<<SKIPSW4101
PLAY/PAUSESW5100
(button release)
000

Although my limited test equipment wasn't able to capture it, otherpeople report (thanks!) that a button release code is sent upon (guesswhat) button release.

This looks like the standard asynchronous protocol implementing a8-bit,no parity, 2 stop bit (8N2) protocol (or it could be also defined as8-bit,mark parity, 1 stop bit depending on how you look at it). This issimilarto the often-used 8N1 protocol, except there is an extra '1' betweencharacters;it's not known if the iPod actually needs this bit. Each group of 11bitsabove is classified composed of one start bit (a 0), followed by 8 databits (least significant bit first), then two hard-to-classify ones.Theseones could be either two stop bits, a stop bit and a mark parity bit,ora stop bit and one just-for-fun mark bit.

So, restated, the 3-byte message sent is:


VOL+0xFF 0xFD 0xF2
VOL-0xFF 0xFD 0xF3
SKIP>>0xFF 0xFD 0xF4
<<SKIP0xFF 0xFD 0xF5
PLAY/PAUSE0xFF 0xFD 0xF1
(button release)0xFF 0xFD 0xF0

There is an interesting quirk brought on by the fact that usualserialprotocols require the data line to be signaling high during the timeinbetweencharacters, but the iPod lowers the signal inbetween the 3-byte packets(although it does keep it high inbetween bytes). At least 4 high highbitsprecede valid data, which seems to be enough to satisfy the iPod'sUART.But, after the three bytes are sent, the data line quickly goes low.Thisisn't usual, and the iPod UART seems to interpret this string of zerosas any other UART would: a start bit, 8 bits of low data (0x00), andthena missing stop bit (a missing 1). The iPod firmware apparently dependson receiving this 0x00, but it's not known if it actually checks to seethat the stop bit is missing. If emulating the remote with a serialport,you should send the 0x00.

Example Microcontroller Code
I made a remote emulator using an Atmel AVR microcontroller. I knowthat doesn't sound like a reasonable thing to do -- after all, the iPodcomes with a perfectly suitable microcontroller -- but it's a goodstartat the design of a protocol translator. This only implements twobuttons- forward and reverse - but it's easily expandable.

The chip I picked is the Atmel ATtiny12-8PI. This is a small 8-pindevicewith 6 usable I/O pins, built-in 1.2 MHz RC oscillator (factorycalibratedto ±1% accuracy), 1K of flash memory, 32 bytes of RAM, and 64bytesof EEPROM. You probably noticed the lack of UART - instead I'm justbit-bangingthe output. It's ok for this single use, but when I eventually try tosimultaneouslyreceive data from my car's bus, I'll have to rewrite this code. Thisversionalso runs off of 5 volts and won't run at 3.3v, so it requires someinterfacecircuitry - you may want to use the 3.3v version, especially if youwantto use the iPod's power, or it's power output as a "connected" signal.

The schematic is pretty simple; I'll just describe how the 8 pins ofthe microcontroller connect:

  • pin 1 - Reset - pull up to +5v with a 50K ohm resistor  (you canremovethe resistor if you program this as an input, but I haven't done thatyet)
  • pin 2 - PB3 - reverse button. Connect with a normally-open pushbuttontoground. No pullup needed.
  • pin 3 - PB4 - forward button. Connect with a normally-open pushbuttontoground. No pullup needed.
  • pin 4 - ground. Besides the power supply, connecting this to the metalback of the iPod worked (instead of connecting to the digital ground inthe remote connector).
  • pin 5 - PB0 - not used
  • pin 6 - PB1 - not used
  • pin 7 - PB2 - output. This needs to be reduced to 3.3 volts, so I useda series divider - this connects to a 220 ohm resistor, which goes tothecenter of the divider, which connects through a 330 ohm resistor toground.I used a 10k ohm resistor from the center to the actual ipod input.Thisdivider is far from optimal - it draws waay too much current (9milliamps!),which is almost enough to pull the output down to 3.7 volts, almosteliminatingthe need for a divider -- but those were the spare parts I had layingaround.
  • pin 8 - +5 volts
Source code is here. Read the notes in thecode describing how toprogram the chip so that the RC oscillator is calibrated.

Others' Work
Bernard Leach has been tackling the iPod side of the remoteinterface. His ipod portoflinux includes a driver for the remote, where he controls aUART. He sees 4 interrupts, one for each byte including the messed-up 0x00terminator. When four bytes are accumulated (there seems to be no synchronizationrulein software that specifies which byte is the first; hopefully the iPodfirmware does this), the bytes are passed to this translationcode:  (version 0.3 shown)

static int ipod_remote_buttons[] = {KEY_1, KEY_2,KEY_3,KEY_4, KEY_5};
static void ipod_remote_process_input(struct ipod_remote *ipod)
{
       static int last_button = 0;

       if ( ipod->data[2] ==0xf0) {
              input_report_key(&ipod->dev, last_button, 0);
       }
       else {
              int pos = ipod->data[2] - 0xf1;
              if ( pos >= 0  && pos < 5 ) {
                      last_button = ipod_remote_buttons[pos];
                      input_report_key(&ipod->dev, last_button, 1);
              }
       }
}

He uses the defines KEY_1 ... KEY_5, arbitrarily from the HP-HILprotocolrather than defining his own incompatible values.


출처: http://www.maushammer.com/systems/ipod-remote/ipod-remote%20copy.html


Tags: ipod 윈도우즈 Share on Facebook Share on X

◀ PREVIOUS
훅 인스턴스의 생성과 해제
▶ NEXT
HTML Color Table
  댓글 0
로그인을 하시면 댓글을 등록 할 수 있습니다.
SIMILAR POSTS

훅 인스턴스의 생성과 해제 (created at 2007-02-06)

virtual와 override 문의 사용법에 대해서 (created at 2007-02-06)

델파이로 긁어오는 HTML 페이지 (created at 2007-02-06)

대문자, 소문자 변환 함수 (created at 2007-02-14)

PC에서 동영상 삭제가 안될때. (created at 2007-02-14)

마우스 커서 모양바꾸기 (created at 2007-01-28)

Windows95/98 암호 알아내기 (created at 2007-01-28)

작업관리자에서 윈도우 감추기 (created at 2007-01-26)

여러가지 시스템 종료 기법 (created at 2007-01-26)

키보드로 마우스 커서 움직이기 (created at 2007-01-26)

파일 등록정보 보여주기 (created at 2007-01-26)

대화상자에 비트맵 올리기 (created at 2007-01-26)

다이얼로그 리소스대로 폼뷰 크기 설정하기 (created at 2007-01-26)

CD, 플로피등의 디스크 삽입 자동 판단루틴 (created at 2007-01-26)

리스트박스 엔터처리 (created at 2007-01-26)

뷰의 배경색 바꾸기 (created at 2007-01-26)

버튼으로 해당 윈도우 종료하기 (created at 2007-01-26)

태스크 바를 없애버리고 싶다 (created at 2007-01-26)

태스크 바에서 프로그램(윈도우) 제목 숨기기 (created at 2007-01-26)

네임드 커널 오브젝트를 사용한 중복 실행 방지법 (created at 2007-01-26)

MSN Live Messenger가 동작이 안되요 (created at 2007-01-26)

WinGate 깔았더니 블루스크린이 떠요 (created at 2007-01-25)

mdb 파일의 암호깨기 (created at 2007-01-25)

윈도우 버전 알아내는 함수 (created at 2007-01-25)

DEP 기능 비활성화 (created at 2007-01-24)

버퍼 오버 플로우 공격과 DEP (created at 2007-01-24)

Internet Explorer가 자주 비정상 종료 할때 (created at 2006-12-29)

VC 에서 자동으로 빌드 넘버 증가하기 (created at 2006-12-28)

GetDC()의 메모리 누수 막기 (created at 2006-12-27)

모달리스 다이얼로그 와 메모리 리크(Leaks) (created at 2006-12-27)

MFC의 TRACE() 출력 빼먹는 현상 (created at 2006-12-27)

간단히 WIN32에서 MFC의 메모리 누수 체크하는 방법 (created at 2006-12-27)

VC++ 6.0 에서 GDI+ 사용하기.. (created at 2006-12-27)

GDI+를 이용한 회전 3가지.... (created at 2006-12-27)

MFC의 GDI/GDI+ 리소스 누수 현상 (created at 2006-12-27)

UTF-8로 파일 저장하기 (created at 2006-12-22)

Internet Explorer의 검색창에서 한글 입력이 안될때 (created at 2006-11-24)

프린터 인쇄 취소가 안될때 (created at 2006-11-24)

spoolsv.exe의 문제 cpu점유률 100% (created at 2006-11-24)

Region을 이용한 부정형 윈도 만들기 (created at 2006-11-16)

ShellExecuteEx를 이용한 커맨드라인 기반 어플리케이션 실행 (created at 2007-05-07)

특정 폴더의 특정 파일만 파일명으로 지우기 (created at 2007-05-07)

노턴 고스트 2005 (9.0) 설치 및 사용방법 (created at 2007-05-13)

WindowsXP 부팅시 부팅 로고 안나오게 하는 방법 (created at 2007-05-14)

초창기 윈도우즈 (created at 2007-05-16)

리아(RIA)가 온다...리아를 주목하라... (created at 2007-05-16)

윈도의 묵묵부답! '무응답 시간' 단축하기 (created at 2007-05-18)

폴더 창 실행 속도 끌어올리기 (created at 2007-05-18)

PC가 점점 느려지고 있다면 바탕화면에 있는 단축 아이콘이 점유하는 메모리 용량을 되찾아라 (created at 2007-05-18)

프로그램 목록에서 지워지지 않는 목록 지우기 (created at 2007-05-18)

OTHER POSTS IN THE SAME CATEGORY

PC가 점점 느려지고 있다면 바탕화면에 있는 단축 아이콘이 점유하는 메모리 용량을 되찾아라 (created at 2007-05-18)

폴더 창 실행 속도 끌어올리기 (created at 2007-05-18)

윈도의 묵묵부답! '무응답 시간' 단축하기 (created at 2007-05-18)

리아(RIA)가 온다...리아를 주목하라... (created at 2007-05-16)

WindowsXP 부팅시 부팅 로고 안나오게 하는 방법 (created at 2007-05-14)

노턴 고스트 2005 (9.0) 설치 및 사용방법 (created at 2007-05-13)

php로 년,월,일 요일 구하기 (created at 2007-05-11)

매번 rand결과가 같게 나오지 않게 하려면 (created at 2007-05-08)

PHP, 정규분포 난수 생성, 가우스 분포 랜덤 발생 함수; Normal Distribution (created at 2007-05-08)

오늘 날짜를 문자열로 변환 (created at 2007-05-08)

특정 폴더의 특정 파일만 파일명으로 지우기 (created at 2007-05-07)

ShellExecuteEx를 이용한 커맨드라인 기반 어플리케이션 실행 (created at 2007-05-07)

PC에서 동영상 삭제가 안될때. (created at 2007-02-14)

대문자, 소문자 변환 함수 (created at 2007-02-14)

HTML Color Table (created at 2007-02-08)

훅 인스턴스의 생성과 해제 (created at 2007-02-06)

virtual와 override 문의 사용법에 대해서 (created at 2007-02-06)

델파이로 긁어오는 HTML 페이지 (created at 2007-02-06)

Apache rewrite 사용 방법 (created at 2007-02-02)

태터툴즈에서 게시물을 id가 아닌 제목으로 뿌리는 방법 (created at 2007-02-02)

애드센스 기록기, Mysense! (created at 2007-02-02)

소켓으로 메일보내기 (created at 2007-01-30)

실수로 삭제한 mysql DB 복구방법 (created at 2007-01-30)

MySQL root 패스워드 분실했을 경우 (created at 2007-01-30)

컴퓨터 활용팁 100가지 (created at 2007-01-30)

마우스 커서 모양바꾸기 (created at 2007-01-28)

이미지가 많아서 로딩할때 시간이 많이걸릴 경우 (created at 2007-01-28)

스크롤바에 붙어다니는 이미지 (created at 2007-01-28)

이미지의 다운로드를 막아주는 스크립트 (created at 2007-01-28)

큰 이미지를 화면크기에 맞게 자동으로 사이즈 조절 (created at 2007-01-28)

UPDATES

소녀대 - Bye Bye Girl (updated at 2024-04-13)

대한민국 날씨 근황 (created at 2024-04-13)

성일종 인재육성 강조하며 이토 히로부미 언급 - 인재 키운 선례? (updated at 2024-04-13)

일제강점기가 더 살기 좋았을지도 모른다는 조수연 국민의힘 후보 - 친일파? (updated at 2024-04-13)

Marshall Ha님의 샤오미 SU7 시승기 - 테슬라의 일론 머스크님이 긴장할만한 느낌 (updated at 2024-04-09)

윙크하는 귀염둥이 반려견들 (created at 2024-04-08)

달콤 살벌한 고백 (created at 2024-04-08)

북한 최정예 공수부대 훈련 모습 (updated at 2024-04-02)

맛있었던 친구 어머니의 주먹밥이 먹고 싶어요 (created at 2024-04-02)

자리 마음에 안든다고 6급 공무원 패는 농협 조합장 (created at 2024-03-26)

85세 딸 짜장면 사주는 102세 어머니 (created at 2024-03-26)

1990년대 감각파 도둑 (created at 2024-03-26)

치매에 걸린 69살의 브루스 윌리스가 전부인 데미무어를 보고 한 말 (updated at 2024-03-22)

경제는 대통령이 살리는 것이 아닙니다 라던 윤석열대통령 - 상황 안좋아지자 여러 전략을 펼쳤지만, 부작용 속출했던 2024년의 봄 (updated at 2024-03-13)

극빈의 생활을 하고 배운것이 없는 사람은 자유가 뭔지도 모를 뿐 아니라 왜 개인에게 필요한지에 대한 필요성을 못느낀다는 윤석열 대통령 (updated at 2024-03-08)

조선일보를 안본다는 사람들이 말하는 그 이유 - 천황폐하, 전두환 각하, 김일성 장군 만세? (created at 2024-03-07)

광폭타이어를 장착하면 성능이 좋아질거라는 착각 (updated at 2024-03-03)

면허시험장에서 면허갱신하면 하루만에 끝나나? (updated at 2024-03-03)

신한은행/신한투자증권 금융거래 종합보고서 다운로드 방법 (updated at 2024-02-26)

100년 된 일본 장난감 회사가 내놓은 변신 기술에 난리난 과학계 (created at 2024-02-26)

알리에서 발견한 한글 지원하는 가성비 쩌는 무선 기계식키보드 (updated at 2024-02-25)

쌍팔년도가 1988년인줄 알았던 1인 (updated at 2024-02-23)

이쁜 색으로 변신한 테슬라 사이버트럭 (created at 2024-02-23)

2024년 카타르 아시안컵 4강전 전날 한국 대표팀 내부에 있었던 이강인의 폭주 (updated at 2024-02-21)

강릉 맛집 지도 (updated at 2024-02-20)

간이 안좋을 때 나타나는 증상 20가지 (updated at 2024-02-20)

배설물을 이용하여 일본에 저항했던 독립운동가 조명하 (updated at 2024-02-20)

요건 몰랐지롱? 이순신을 사랑한 외국인 (created at 2024-02-20)

원빈도 머리빨 (created at 2024-02-19)

대표적인 대한민국의 미남배우 중 하나인 원빈 (created at 2024-02-19)

백제의 건국 시조 온조왕 (updated at 2024-02-19)

700년동안 대한민국 고대국가의 한축이었던 백제시대 (created at 2024-02-19)

대머리들에게 주는 대머리의 조언 (created at 2024-02-17)

일본의 여성 락그룹 프린세스 프린세스의 "다이아몬드" (created at 2024-02-17)

결혼식 직전 연락두절된 신랑 (created at 2024-02-17)

대한민국 축구팀 파문으로 인해 중국 소셜미디어까지 등장한 탁구 전도사 이강인 (updated at 2024-02-16)

조국의 반격으로 흥미진진하게 흘러가는 한국의 정치판 - 데뷰와 동시에 한동훈 장관에게 던진 4개의 질문 (updated at 2024-02-15)

2024년 카타르 아시안컵 4강전 전날 내분사태로 갑자기 회자되는 이승우선수의 친화력 (created at 2024-02-15)

카카오뱅크 금융거래종합보고서/잔액증명서/거래내역서 발급 방법 (created at 2024-02-14)

아이가 최고의 스승이었다 (created at 2024-02-13)

이제는 국민 유행어로 등극한 한동훈의 "싫으면 시집가" (updated at 2024-02-13)

설 연휴 잔소리 메뉴판 - 이제 잔소리 하기전에 요금부터... (updated at 2024-02-10)

로버트 드니로의 70년 전 모습 (created at 2024-02-08)

카메라 어플로 만들어본 슈퍼걸 - 엄... 최종 작품은 왠지... (created at 2024-02-08)

앞트임 하고 새롭게 태어난 대한민국의 젊은 용사 (created at 2024-02-08)

비가 억수로 내리던 2024년의 2월 어느날 캘리포니아의 밤 카니예 웨스트와 그의 아나 비앙카 센소리 (updated at 2024-02-08)

스케방형사 1화 - 수수께끼의 전학소녀사키 (created at 2024-02-05)

백제와 일본의 교류가 가장 활발했던 시기는 근초고왕 시대 (created at 2024-02-05)

일에 찌들은 아빠가 꿈에서 깨어나지 않자 구출해주는 짱구 (created at 2024-02-03)

이제는 할아버지가 된 휴 그랜트(Hugh Grant)가 블랙핑크 콘서트에 다녀온 후 소감 (created at 2024-02-03)