summaryrefslogtreecommitdiff
path: root/apps/iap/iap-lingo2.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/iap/iap-lingo2.c')
-rw-r--r--apps/iap/iap-lingo2.c26
1 files changed, 26 insertions, 0 deletions
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)
56 56
57void iap_handlepkt_mode2(const unsigned int len, const unsigned char *buf) 57void iap_handlepkt_mode2(const unsigned int len, const unsigned char *buf)
58{ 58{
59 static bool poweron_pressed = false;
59 unsigned int cmd = buf[1]; 60 unsigned int cmd = buf[1];
60 61
61 /* We expect at least three bytes in the buffer, one for the 62 /* 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)
136 } 137 }
137 } 138 }
138 139
140 if (buf[4] & 2) /* power on */
141 {
142 poweron_pressed = true;
143 }
144
139 /* Power off 145 /* Power off
140 * Not quite sure how to react to this, but stopping playback 146 * Not quite sure how to react to this, but stopping playback
141 * is a good start. 147 * is a good start.
@@ -152,6 +158,26 @@ void iap_handlepkt_mode2(const unsigned int len, const unsigned char *buf)
152 REMOTE_BUTTON(BUTTON_RC_LEFT); 158 REMOTE_BUTTON(BUTTON_RC_LEFT);
153 } 159 }
154 160
161 /* power on released */
162 if (poweron_pressed && len >= 5 && !(buf[4] & 2))
163 {
164 poweron_pressed = false;
165#ifdef HAVE_LINE_REC
166 /* Belkin TuneTalk microphone sends power-on press+release
167 * events once authentication sequence is finished,
168 * GetDevCaps command is ignored by the device when it is
169 * sent before power-on release event is received.
170 * XXX: It is unknown if other microphone devices are
171 * sending the power-on events.
172 */
173 if (DEVICE_LINGO_SUPPORTED(0x01)) {
174 /* GetDevCaps */
175 IAP_TX_INIT(0x01, 0x07);
176 iap_send_tx();
177 }
178#endif
179 }
180
155 break; 181 break;
156 } 182 }
157 /* ACK (0x01) 183 /* ACK (0x01)