BUG 11301: Prevent Multiple StartIDPS

This commit is contained in:
Russell Gallop
2011-09-15 11:22:15 +01:00
parent f5ff31d730
commit 5d47bbe30e

View File

@@ -74,6 +74,7 @@ extern int data_to_send;
//// state for GetDevAuthenticationSignature //// state for GetDevAuthenticationSignature
//int startup = 1; //int startup = 1;
extern unsigned authenticating; extern unsigned authenticating;
extern unsigned identificationstarted;
extern port p_i2c_scl; extern port p_i2c_scl;
extern port p_i2c_sda; extern port p_i2c_sda;
@@ -321,10 +322,13 @@ chanend c_iap, chanend ?c_i2c // iOS stuff
break; break;
case !(isTX || isRX) => iap_get_ack_or_reset_or_data(c_iap, is_ack, is_reset, datum): case !(isTX || isRX) => iap_get_ack_or_reset_or_data(c_iap, is_ack, is_reset, datum):
if (is_reset) { if (is_reset) {
// Do regardless
authenticating = 1; authenticating = 1;
port32A_set(P32A_I2C_NOTMIDI);
// Prevent multiple issuing of StartIDPS (may need to handle it getting lost)
if (!identificationstarted) {
// Start buffer with StartIDPS message in // Start buffer with StartIDPS message in
iap_bufferlen = StartIDPS(iap_buffer); iap_bufferlen = StartIDPS(iap_buffer);
port32A_set(P32A_I2C_NOTMIDI);
for (int i = 0; i != iap_bufferlen; i++) { for (int i = 0; i != iap_bufferlen; i++) {
enqueue(to_host_fifo, iap_buffer[i]); enqueue(to_host_fifo, iap_buffer[i]);
} }
@@ -332,7 +336,8 @@ authenticating = 1;
// Start the ball rolling (so I will be expecting an ack) // Start the ball rolling (so I will be expecting an ack)
outuint(c_iap, dequeue(to_host_fifo)); outuint(c_iap, dequeue(to_host_fifo));
ith_count++; ith_count++;
identificationstarted = 1;
}
} else { } else {
//printstrln("iap_get_ack_or_data"); //printstrln("iap_get_ack_or_data");
if (is_ack) { if (is_ack) {