From be5fc0ff7f01ad2e5b964ca437674c15a7a8bd71 Mon Sep 17 00:00:00 2001 From: Cástor Muñoz Date: Sat, 6 Dec 2014 23:28:31 +0100 Subject: iAP: lingo 1 (microphone) Change-Id: I65da2064951972368a2880d271280e5b5ae878fe --- apps/iap/iap-lingo2.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'apps/iap/iap-lingo2.c') diff --git a/apps/iap/iap-lingo2.c b/apps/iap/iap-lingo2.c index 4fbf730192..d4c2f18c2f 100644 --- a/apps/iap/iap-lingo2.c +++ b/apps/iap/iap-lingo2.c @@ -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) -- cgit v1.2.3