Rockbox Technical Forums

Support and General Use => Hardware => Topic started by: shelob144 on February 25, 2022, 10:50:35 PM

Title: iPod Mini 1G - IAP - Creating a custom accessory
Post by: shelob144 on February 25, 2022, 10:50:35 PM
Hi,

I have recently been experimenting with controlling my 1st Gen iPod mini with an Arduino (using the dock connector's RX pin, fed by the TX pin of the Arduino).

I am able to successfully send iPod Remote commands (i.e. Mode 2 commands described here -> http://www.ipodlinux.org/Apple_Accessory_Protocol/) to the default Apple operating system, but Rockbox doesn't seem to react to the commands that I send. I am using Rockbox version 3.15.

The Arduino is being powered properly, and the baud rate settings match (19200).

The default operating system's IAP implementation is satisfied with simple Mode 2 commands (no additional setup commands required). I looked into the Rockbox source code a bit, and it looks like you have to send the appropriate Mode 0 (http://www.ipodlinux.org/Apple_Accessory_Protocol/) command in order to negotiate lingos. I am pretty sure I added this to my code correctly (so that I can have access to lingo 2), but am still not able to get Rockbox to register my IAP commands.

So basically, my question is: are there any other IAP commands that I need to add to my project in order to get it to work with Rockbox's implementation of the IAP? I'll include the pseudocode for the serial commands I am currently sending:
Code: [Select]
//Lingo negotiation portion
TX_Write(0xFF) //Header byte 1
TX_Write(0x55) //Header byte 2
TX_Write(0x03) //Length of mode+command+parameter
TX_Write(0x00) //Mode (lingo 0)
TX_Write(0x01) //Command byte 1
TX_Write(0x02) //Command byte 2
TX_Write(0xFA) //Checksum

Delay(2000) //Wait 2 seconds

//Play/pause command
TX_Write(0xFF) //Header byte 1
TX_Write(0x55) //Header byte 2
TX_Write(0x03) //Length of mode+command+parameter
TX_Write(0x02) //Mode (lingo 2, which should be negotiated by now)
TX_Write(0x00) //Command byte 1
TX_Write(0x01) //Command byte 2
TX_Write(0xFA) //Checksum

Delay(15) //Wait 15 ms (so that we send a command roughly 66 times per second)

//Release Button Command
TX_Write(0xFF) //Header byte 1
TX_Write(0x55) //Header byte 2
TX_Write(0x03) //Length of mode+command+parameter
TX_Write(0x02) //Mode (lingo 2, which should be negotiated by now)
TX_Write(0x00) //Command byte 1
TX_Write(0x00) //Command byte 2
TX_Write(0xFB) //Checksum
Title: Re: iPod Mini 1G - IAP - Creating a custom accessory
Post by: shelob144 on March 24, 2022, 06:12:01 PM
My code works perfectly fine on my new iPod Classic 5G, so the Rockbox implementation of the IAP does work, just not properly on the iPod Mini 1G apparently.
Title: Re: iPod Mini 1G - IAP - Creating a custom accessory
Post by: 7o9 on March 25, 2022, 12:44:16 PM
I am not saying it might help to try a current dev build, but 3.15 is very old now.

If it does not work with current either, I am sure a patch to make it work is welcomed.