iAP: lingo 1 (microphone)

Change-Id: I65da2064951972368a2880d271280e5b5ae878fe
This commit is contained in:
Cástor Muñoz 2014-12-06 23:28:31 +01:00
parent b2d650f511
commit be5fc0ff7f
7 changed files with 271 additions and 1 deletions

View file

@ -56,6 +56,7 @@ static void cmd_ack(const unsigned char cmd, const unsigned char status)
void iap_handlepkt_mode2(const unsigned int len, const unsigned char *buf)
{
static bool poweron_pressed = false;
unsigned int cmd = buf[1];
/* We expect at least three bytes in the buffer, one for the
@ -136,6 +137,11 @@ void iap_handlepkt_mode2(const unsigned int len, const unsigned char *buf)
}
}
if (buf[4] & 2) /* power on */
{
poweron_pressed = true;
}
/* Power off
* Not quite sure how to react to this, but stopping playback
* is a good start.
@ -152,6 +158,26 @@ void iap_handlepkt_mode2(const unsigned int len, const unsigned char *buf)
REMOTE_BUTTON(BUTTON_RC_LEFT);
}
/* power on released */
if (poweron_pressed && len >= 5 && !(buf[4] & 2))
{
poweron_pressed = false;
#ifdef HAVE_LINE_REC
/* Belkin TuneTalk microphone sends power-on press+release
* events once authentication sequence is finished,
* GetDevCaps command is ignored by the device when it is
* sent before power-on release event is received.
* XXX: It is unknown if other microphone devices are
* sending the power-on events.
*/
if (DEVICE_LINGO_SUPPORTED(0x01)) {
/* GetDevCaps */
IAP_TX_INIT(0x01, 0x07);
iap_send_tx();
}
#endif
}
break;
}
/* ACK (0x01)