Untested patch for Ir (NOT IrDA!) connections
[gnokii.git] / common / newmodules / n6110.c
index a459961..26225db 100644 (file)
@@ -642,9 +642,7 @@ GSM_Error N6110_Initialise(char *port_device, char *initlength,
                           void (*rlp_callback)(RLP_F96Frame *frame))
 {
   unsigned char init_char = N6110_SYNC_BYTE;
-#ifndef UCLINUX
   unsigned char end_init_char = N6110_IR_END_SYNC_BYTE;
-#endif /* UCLINUX */
 
   int count;
   int InitLength;
@@ -674,8 +672,8 @@ GSM_Error N6110_Initialise(char *port_device, char *initlength,
 #endif /* UCLINUX */
       
     case GCT_FBUS:
-#ifndef UCLINUX
     case GCT_Infrared:
+#ifndef UCLINUX
     case GCT_Tekram:
 #endif /* UCLINUX */
       InitLength = atoi(initlength);
@@ -684,15 +682,16 @@ GSM_Error N6110_Initialise(char *port_device, char *initlength,
         InitLength = 250;      /* This is the usual value, lower may work. */
       }
 
+      if (CurrentConnectionType==GCT_Infrared
 #ifndef UCLINUX
-      if (CurrentConnectionType==GCT_Infrared ||
-          CurrentConnectionType==GCT_Tekram) {
+          || CurrentConnectionType==GCT_Tekram
+#endif /* UCLINUX */
+         ) {
 #ifdef DEBUG
         fprintf(stdout,_("Setting infrared for FBUS communication...\n"));
 #endif
         device_changespeed(9600);
       }
-#endif /* UCLINUX */
 
 #ifdef DEBUG
       fprintf(stdout,_("Writing init chars...."));
@@ -702,32 +701,34 @@ GSM_Error N6110_Initialise(char *port_device, char *initlength,
       /* Send init string to phone, this is a bunch of 0x55 characters. Timing is
          empirical. */
       for (count = 0; count < InitLength; count ++) {
+        if (CurrentConnectionType!=GCT_Infrared
 #ifndef UCLINUX
-        if (CurrentConnectionType!=GCT_Infrared &&
-            CurrentConnectionType!=GCT_Tekram)
+            && CurrentConnectionType!=GCT_Tekram
 #endif /* UCLINUX */
-                                       usleep(100);
+           ) usleep(100);
         Protocol->WritePhone(1,&init_char);
       }
 
+      if (CurrentConnectionType==GCT_Infrared
 #ifndef UCLINUX
-      if (CurrentConnectionType==GCT_Infrared ||
-          CurrentConnectionType==GCT_Tekram)      {
+          || CurrentConnectionType==GCT_Tekram
+#endif /* UCLINUX */
+         )      {
         Protocol->WritePhone(1,&end_init_char);
         usleep(200000);
       }
-#endif /* UCLINUX */
 
 #ifdef DEBUG
       fprintf(stdout,_("Done\n"));  
 #endif
 
+      if (CurrentConnectionType==GCT_Infrared
 #ifndef UCLINUX
-      if (CurrentConnectionType==GCT_Infrared ||
-          CurrentConnectionType==GCT_Tekram)      {
+          || CurrentConnectionType==GCT_Tekram
+#endif /* UCLINUX */
+         )      {
         device_changespeed(115200);    
       }
-#endif /* UCLINUX */
 
       N6110_SendStatusRequest();