Emulating Carbon-copy of NDS-sniffed packets
[gnokii.git] / common / newmodules / n6110.c
index fcb8ac9..3fdd16a 100644 (file)
@@ -431,6 +431,8 @@ GSM_Error N6110_SendStatusRequest(void)
 
 static void N6110_ReplyGetAuthentication(u16 MessageLength, u8 *MessageBuffer, u8 MessageType) {
 
+  LIVE;
+
 #if defined WIN32 || !defined HAVE_SNPRINTF
   sprintf(Current_IMEI, "%s", MessageBuffer+9);
   sprintf(Current_Model, "%s", MessageBuffer+25);
@@ -594,6 +596,14 @@ static GSM_Error N6110_Authentication()
   
   0x00, 0x00, 0x00, 0x00};
 
+  unsigned char req3_55[]  = { N6110_FRAME_HEADER, 0x42,0x05,0x01,
+                              0x07,0xa2,0x88,0x81,0x21,0x55,0x63,0xa8,0x00,0x00,
+                              0x07,0xa3,0xb8,0x81,0x20,0x15,0x63,0x80 };
+  unsigned char req3[]     = { N6110_FRAME_HEADER, 0x42,0x05,0x01,
+                              0x07,0xa2,0x88,0x81,0x21,0x15,0x63,0xa8,0x00,0x00,
+                              0x07,0xa3,0xb8,0x81,0x20,0x15,0x63,0x80 };
+  unsigned char unknown_05[] = {N6110_FRAME_HEADER, 0x05};
+
 #ifdef DEBUG
   fprintf(stdout,_("Making authentication!\n"));
 #endif
@@ -602,15 +612,23 @@ static GSM_Error N6110_Authentication()
   usleep(100); Protocol->SendMessage(5, 0x02, connect2);
   usleep(100); Protocol->SendMessage(7, 0x02, connect3);
       
+  usleep(100); Protocol->SendMessage(sizeof(req3_55), 0x01, req3_55);  /* Lace */
+
   CurrentMagicError = GE_BUSY;
 
   usleep(100); Protocol->SendMessage(4, 0x64, connect4);
+
+  usleep(100); Protocol->SendMessage(sizeof(req3_55), 0x01, req3_55);  /* Lace */
+  usleep(100); Protocol->SendMessage(sizeof(req3), 0x01, req3);        /* Lace */
+
   if (NULL_WaitUntil(50,&CurrentMagicError)!=GE_NONE) return GE_TIMEOUT;
 
   N6110_GetNokiaAuth(Current_IMEI, MagicBytes, magic_connect+4);
 
   Protocol->SendMessage(45, 0x64, magic_connect);
 
+  usleep(100); Protocol->SendMessage(4, 0x04, unknown_05); /* Lace */
+
 #ifdef DEBUG
   fprintf(stdout,_("End of authentication!\n"));
 #endif
@@ -721,7 +739,12 @@ GSM_Error N6110_Initialise(char *port_device, char *initlength,
          After making it phone display "Accessory connected"
          and probably give access to some function (I'm not too sure about it !)
          Anyway, I make it now for N51xx/61xx */
-      if (GetModelFeature (FN_AUTHENTICATION)!=0) {
+#if 1
+      if (GetModelFeature (FN_AUTHENTICATION)!=0)
+#else
+      if (0/*Lace-hack:GetModelFeature (FN_AUTHENTICATION)!=0*/)
+#endif
+       {
         if (N6110_Authentication()!=GE_NONE) return GE_TIMEOUT;
       } else {        /* No authentication */
         if (N6110_SendIMEIFrame()!=GE_NONE) return GE_TIMEOUT;    
@@ -2575,6 +2598,8 @@ GSM_Error N6110_DialData(char *Number, char type, void (* callpassup)(char c))
 
        switch (type) {
        case 0:
+               usleep(100); Protocol->SendMessage(sizeof(req3), 0x01, req3);   /* Lace */
+               usleep(100);
                req_end = req_end0;
                size = sizeof(req_end0);
                break;
@@ -2604,7 +2629,10 @@ GSM_Error N6110_DialData(char *Number, char type, void (* callpassup)(char c))
 
        Protocol->SendMessage(5 + size + strlen(Number), 0x01, req);
        usleep(1000000);
+
+#if 0
        if (type != 1) Protocol->SendMessage(26, 0x01, req2);
+#endif
 
        return (GE_NONE);
 }