Dependents:   Test_Wiimote

Revision:
2:5c2bfbd63297
Parent:
0:f6f434d9a03a
--- a/hci.cpp	Sat Dec 17 02:26:07 2011 +0000
+++ b/hci.cpp	Sat Dec 17 06:53:39 2011 +0000
@@ -165,11 +165,15 @@
             break;
 
         case HCI_OP_PIN_CODE_REPLY:
+#ifdef DEBUG_WII
             printf("Got pin reply\n");
+#endif            
             break;
 
         default:
+#ifdef DEBUG_WII
             printf("Unrecognized Command %04X\n",cmd);
+#endif            
             break;
     }
 }
@@ -207,7 +211,9 @@
     if (!d)
         return ERR_HCI_DEVICE_NOT_FOUND;
     int handle = d->_handle;
+#ifdef DEBUG_WII
     printf("Disconnect from %d\n",handle);
+#endif
     _state |= MASK_CREATE_CONNECTION;
     u8 buf[3];
     buf[0] = handle;
@@ -262,7 +268,9 @@
         }
         if (!bt)
         {
+#ifdef DEBUG_WII
             printf("HCI::InquiryResult too many devices\n");
+#endif            
             return; // Too many devices!
         }
     }
@@ -303,9 +311,14 @@
     if (info->status == 0)
     {
         d->_handle = info->handle;
+#ifdef DEBUG_WII
         printf("Connected on %04X\n",info->handle);
-    } else
+#endif        
+    } else {
+#ifdef DEBUG_WII
         printf("Connection failed with %d\n",info->status);
+#endif       
+    } 
 }
 
 void HCI::HCIRecv(const u8* data, int len)
@@ -314,7 +327,9 @@
     switch (data[0])
     {
         case HCI_EV_INQUIRY_COMPLETE:
+#ifdef DEBUG_WII
             printfBytes("Inquiry Complete",data,data[1]);
+#endif            
             _state &= ~MASK_INQUIRY;
             Callback(CALLBACK_INQUIRY_DONE,0,0);
             break;
@@ -364,7 +379,9 @@
         case HCI_EV_CMD_STATUS:
             {
                 const char* errs = HCIErrStr(data[2]);
+#ifdef DEBUG_WII              
                 printf("Status %s %s\n",CmdStr(LE16(data+4)),errs);
+#endif                
             }
             break;
 
@@ -393,9 +410,11 @@
     BTDevice* bt = Find(&l2capaddr->bdaddr);
     if (!bt)
     {
+#ifdef DEBUG_WII
         printf("Can't open l2cap %d on ",l2capaddr->psm);
         printf(&l2capaddr->bdaddr);
         printf("\n");
+#endif
         return ERR_HCI_DEVICE_NOT_FOUND;
     }
     l2capsock->btdevice = bt;