• R/O
  • SSH
  • HTTPS

libwiiremote: Commit


Commit MetaInfo

Revision97 (tree)
Time2008-02-16 02:28:13
Authorsay

Log Message

* Fixed the size of device_state_update_flags.
* Fixed device_state_update_flags clear bug.

Change Summary

Incremental Difference

--- libwiiremote/src/wiiremote.c (revision 96)
+++ libwiiremote/src/wiiremote.c (revision 97)
@@ -31,7 +31,7 @@
3131 int functions[WRMT_NUMBER_OF_FUNCTIONS];
3232 int device_state[WRMT_NUMBER_OF_DATA_TYPE];
3333 unsigned char function_updated_flags[WRMT_NUMBER_OF_FUNCTIONS];
34- unsigned char device_state_updated_flags[WRMT_NUMBER_OF_FUNCTIONS];
34+ unsigned char device_state_updated_flags[WRMT_NUMBER_OF_DATA_TYPE];
3535 };
3636
3737 #define WRMT_WiiRemote_Invaliant(self) \
@@ -186,6 +186,7 @@
186186 input_buffer[7] == 0xff &&
187187 input_buffer[8] == 0xff)
188188 {
189+ DebugLog("IR1 not found\n");
189190 device_state[WRMT_DATA_IR1_FOUND] = 0;
190191 device_state[WRMT_DATA_IR1_SIZE] = 0;
191192 device_state[WRMT_DATA_IR1_X] = 0;
@@ -193,6 +194,7 @@
193194 }
194195 else
195196 {
197+ DebugLog("IR1 found\n");
196198 device_state[WRMT_DATA_IR1_FOUND] = 1;
197199 device_state[WRMT_DATA_IR1_SIZE] = input_buffer[ 8] & 0x0f;
198200 device_state[WRMT_DATA_IR1_X] = input_buffer[ 6];
@@ -205,6 +207,7 @@
205207 input_buffer[10] == 0xff &&
206208 input_buffer[11] == 0xff)
207209 {
210+ DebugLog("IR2 not found\n");
208211 device_state[WRMT_DATA_IR2_FOUND] = 0;
209212 device_state[WRMT_DATA_IR2_SIZE] = 0;
210213 device_state[WRMT_DATA_IR2_X] = 0;
@@ -212,6 +215,7 @@
212215 }
213216 else
214217 {
218+ DebugLog("IR2 found\n");
215219 device_state[WRMT_DATA_IR2_FOUND] = 1;
216220 device_state[WRMT_DATA_IR2_SIZE] = input_buffer[11] & 0x0f;
217221 device_state[WRMT_DATA_IR2_X] = input_buffer[ 9];
@@ -256,6 +260,7 @@
256260 #ifdef DUMP_INPUT_BUFFER
257261 {
258262 int i;
263+ fprintf(stderr, "input_buffer : ");
259264 for (i = 0;i < WRMT_BUFFER_SIZE;i++)
260265 fprintf(stderr, "%02x ", self->input_buffer[i]);
261266 fprintf(stderr, "\n");
@@ -313,12 +318,15 @@
313318 WRMT_WiiRemote_ValidateOutputReport(self);
314319 DebugLog("Hello\n");
315320
316- int i;
317- for (i = 0;i < WRMT_BUFFER_SIZE;i++)
321+#ifdef DUMP_OUTPUT_BUFFER
318322 {
319- fprintf(stderr, "%02x ", self->output_buffer[i]);
323+ int i;
324+ fprintf(stderr, "output_buffer : ");
325+ for (i = 0;i < WRMT_BUFFER_SIZE;i++)
326+ fprintf(stderr, "%02x ", self->output_buffer[i]);
327+ fprintf(stderr, "\n");
320328 }
321- fprintf(stderr, "\n");
329+#endif
322330
323331 for (retry_count = OUTPUT_RETRY_COUNT;retry_count > 0;retry_count--)
324332 {
@@ -717,7 +725,7 @@
717725 WRMT_WiiRemote *result = NULL;
718726 assert(device_index >= 0 &&
719727 device_index < WRMT_Impl_GetNumWiiRemote());
720- DebugLog("Hello\n");
728+ DebugLog("Hello device_index = %d\n", device_index);
721729
722730 result = &(wiiRemoteList[device_index]);
723731
@@ -731,7 +739,7 @@
731739 {
732740 WRMT_IOReturn result;
733741 WRMT_WiiRemote_Invaliant(self);
734- DebugLog("Hello\n");
742+ DebugLog("Hello self = %p\n", self);
735743
736744 result = WRMT_WiiRemoteImpl_Open(self->impl);
737745 if (result == WRMT_IO_SUCCESS)
@@ -853,19 +861,17 @@
853861 result = WRMT_WiiRemote_SendReportTypeRequest(self);
854862 if (result != WRMT_IO_SUCCESS) return result;
855863
864+ if (self->function_updated_flags[WRMT_FUNCTION_IR])
865+ {
866+ result = WRMT_WiiRemote_SendIRParameters(self);
867+ if (result != WRMT_IO_SUCCESS) return result;
868+ }
869+
856870 self->function_updated_flags[WRMT_FUNCTION_CONTINUOUS] = 0;
857871 self->function_updated_flags[WRMT_FUNCTION_MOTION] = 0;
858872 self->function_updated_flags[WRMT_FUNCTION_IR] = 0;
859873 }
860874
861- if (self->function_updated_flags[WRMT_FUNCTION_IR])
862- {
863- result = WRMT_WiiRemote_SendIRParameters(self);
864- if (result != WRMT_IO_SUCCESS) return result;
865-
866- self->function_updated_flags[WRMT_FUNCTION_IR] = 0;
867- }
868-
869875 if (self->function_updated_flags[WRMT_FUNCTION_SPEAKER])
870876 {
871877 result = WRMT_WiiRemote_SetUpSpeaker(self);
Show on old repository browser