X-Git-Url: http://git.jankratochvil.net/?p=gnokii.git;a=blobdiff_plain;f=common%2Fprotocol%2Ffbus.c;fp=common%2Fprotocol%2Ffbus.c;h=99e1d52700c9ee9e6b2b23eef37f2b0fc05036eb;hp=af7eaac4007a3b8d08304cce0d842ac2c7005779;hb=82bcbc2300f764bcb3551b152a0a961f4fef5e66;hpb=975a83d253eea8aa37bf3dfd7e026df3027db4ff;ds=sidebyside diff --git a/common/protocol/fbus.c b/common/protocol/fbus.c index af7eaac..99e1d52 100644 --- a/common/protocol/fbus.c +++ b/common/protocol/fbus.c @@ -256,18 +256,6 @@ void FBUS_RX_StateMachine(unsigned char rx_byte) { int i=0; -// if (CurrentConnectionType==GCT_DLR3) { -// AT_RX_StateMachine(rx_byte); -// } else { - -#ifdef XDEBUG_LaceDisabled - if (isprint(rx_byte)) - fprintf(stdout, "[%02x%c]", rx_byte, rx_byte); - else - fprintf(stdout, "[%02x ]", rx_byte); - fflush(stdout); -#endif - #ifdef DEBUG /* For model sniff only display received bytes */ if (strcmp(GSM_Info->FBUSModels, "sniff")) @@ -531,22 +519,17 @@ void FBUS_RX_StateMachine(unsigned char rx_byte) { } #endif - -// } } /* Called by initialisation code to open comm port in asynchronous mode. */ static bool FBUS_OpenSerial(void) { +#ifndef UCLINUX /* Uncomment, if want to test first method for DLR3 */ -// unsigned char req[3] = {"AT\r"}; -// unsigned char req2[5] = {"AT&F\r"}; -// unsigned char req3[13] = {"AT*NOKIAFBUS\r"}; - -// GSM_Error error; - -// GSM_Information *GSMINFOCOPY; -// GSM_Functions *GSMCOPY; + unsigned char req[3] = {"AT\r"}; + unsigned char req2[5] = {"AT&F\r"}; + unsigned char req3[13] = {"AT*NOKIAFBUS\r"}; +#endif /* UCLINUX */ switch (CurrentConnectionType) { case GCT_FBUS: @@ -581,66 +564,33 @@ static bool FBUS_OpenSerial(void) /* There are 2 ways to init DLR in FBUS: Here is first described by Reuben Harris [reuben.harris@snowvalley.com] and used in Logo Manager, - 1. Firstly set the connection baud to 19200, DTR off, RTS off, - Parity on, one stop bit, - 2. Send "AT\r\n". The response should be "AT\r\n\r\nOK\r\n". - 3. Send "AT&F\r\n". The response should be "AT&F\r\n\r\nOK\r\n". - 4. Send "AT*NOKIAFBUS\r\n". The response should be - "AT*NOKIAFBUS\r\n\r\nOK\r\n". - 5. Set speed to 115200 + 1. Firstly set the connection baud to 19200, DTR off, RTS off, + Parity on, one stop bit, + 2. Send "AT\r\n". The response should be "AT\r\n\r\nOK\r\n". + 3. Send "AT&F\r\n". The response should be "AT&F\r\n\r\nOK\r\n". + 4. Send "AT*NOKIAFBUS\r\n". The response should be + "AT*NOKIAFBUS\r\n\r\nOK\r\n". + 5. Set speed to 115200 + This seems to be compatible with more phones*/ - This is one should be used by us, because seems to be compatible with more - phones. But we make something wrong and often phones don't want to start transmision */ - - /* Uncomment and test if want */ -// device_changespeed(19200); + device_changespeed(19200); /*leave RTS low, DTR low for duration of session.*/ -// device_setdtrrts(0, 0); - - /* Making copy of pointers */ -// GSMCOPY = GSM; -// GSMINFOCOPY =GSM_Info; - - /* Set pointers to relevant addresses - new "AT" module here is required */ -// GSM = &Nat_Functions; -// GSM_Info = &Nat_Information; - - /* Note: We change Protocol inside function pointed by it. - That's why in FBUS_RX_StateMachine we must check it (changing - Protocol is not enough), This is for correct work and be sure... */ -// Protocol = &AT_Functions; - -// error=N6110_SendMessageSequence (50, &CurrentGetHWError, 3, 0x00, req); -// if (error!=GE_NONE) return false; - -// error=N6110_SendMessageSequence (50, &CurrentGetHWError, 5, 0x00, req2); -// if (error!=GE_NONE) return false; - -// error=N6110_SendMessageSequence (50, &CurrentGetHWError, 13, 0x00, req3); -// if (error!=GE_NONE) return false; - - /* Returning to old protocol */ -// Protocol = &FBUS_Functions; - - /* Returning to old module */ -// GSM = GSMCOPY; -// GSM_Info = GSMINFOCOPY; - -// device_changespeed(115200); - - /* Second method for DLR3: - Used by some 7110 soft, but not compatible with some other - phones supporting DLR3 - 7160, NCP2.0 - Used in this moment in mygnokii - */ + device_setdtrrts(0, 0); + + Protocol->WritePhone (3,req );usleep(300); + Protocol->WritePhone (5,req2);usleep(300); + Protocol->WritePhone(13,req3);usleep(300); device_changespeed(115200); - /*leave RTS low, DTR low for duration of session.*/ - device_setdtrrts(0, 0); - - usleep(100000); +// /* Second method for DLR3: +// Used by some 7110 soft, but not compatible with some other +// phones supporting DLR3 - 7160, NCP2.0*/ +// device_changespeed(115200); +// /*leave RTS low, DTR low for duration of session.*/ +// device_setdtrrts(0, 0); +// usleep(100000); CurrentConnectionType=GCT_FBUS;