strcpy(text,"Connection ");
switch (con) {
case GCT_FBUS :strcpy(text+strlen(text),"FBUS");break;
+ case GCT_Infrared:strcpy(text+strlen(text),"infrared");break;
#ifndef UCLINUX
+ case GCT_Irda :strcpy(text+strlen(text),"irda sockets");break;
case GCT_MBUS :strcpy(text+strlen(text),"MBUS");break;
case GCT_DLR3 :strcpy(text+strlen(text),"DLR3");break;
+ case GCT_Tekram :strcpy(text+strlen(text),"Tekram");break;
case GCT_AT :strcpy(text+strlen(text),"AT");break;
default :strcpy(text+strlen(text),"unknown");break;
#endif /* UCLINUX */
strcpy(text,"Connection ");
switch (con) {
case GCT_FBUS :strcpy(text+strlen(text),"FBUS");break;
+ case GCT_Infrared:strcpy(text+strlen(text),"infrared");break;
+#ifndef UCLINUX
+ case GCT_Irda :strcpy(text+strlen(text),"irda sockets");break;
case GCT_MBUS :strcpy(text+strlen(text),"MBUS");break;
case GCT_DLR3 :strcpy(text+strlen(text),"DLR3");break;
+ case GCT_Tekram :strcpy(text+strlen(text),"Tekram");break;
case GCT_AT :strcpy(text+strlen(text),"AT");break;
+#endif /* UCLINUX */
default :strcpy(text+strlen(text),"unknown");break;
}
strcpy(text+strlen(text),"\n");
if (strstr(InfoToCheck.MBUSModels, model) != NULL) {
if (connection==GCT_MBUS) found_match=true;
}
+#endif /* UCLINUX */
if (strstr(InfoToCheck.InfraredModels, model) != NULL) {
if (connection==GCT_Infrared) found_match=true;
}
+#ifndef UCLINUX
if (strstr(InfoToCheck.DLR3Models, model) != NULL) {
if (connection==GCT_DLR3) found_match=true;
}
if (found_match) {
switch (connection) {
case GCT_FBUS : Protocol = &FBUS_Functions; break;
-#ifndef UCLINUX
case GCT_Infrared: Protocol = &FBUS_Functions; break;
+#ifndef UCLINUX
case GCT_Tekram : Protocol = &FBUS_Functions; break;
case GCT_DLR3 : Protocol = &FBUS_Functions; break;
case GCT_MBUS : Protocol = &MBUS_Functions; break;
#ifndef UCLINUX
if (!strcmp(Connection, "irda")) connection=GCT_Irda;
+#endif /* UCLINUX */
if (!strcmp(Connection, "infrared")) connection=GCT_Infrared;
+#ifndef UCLINUX
if (!strcmp(Connection, "mbus")) connection=GCT_MBUS;
if (!strcmp(Connection, "dlr3")) connection=GCT_DLR3;
if (!strcmp(Connection, "fbus3110")) connection=GCT_FBUS3110;
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;
#endif /* UCLINUX */
case GCT_FBUS:
-#ifndef UCLINUX
case GCT_Infrared:
+#ifndef UCLINUX
case GCT_Tekram:
#endif /* UCLINUX */
InitLength = atoi(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...."));
/* 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();
case FBUS_RX_Sync:
if ((CurrentConnectionType==GCT_FBUS && rx_byte == FBUS_FRAME_ID) ||
- 0/*((CurrentConnectionType==GCT_Infrared ||
- CurrentConnectionType==GCT_Tekram) && rx_byte == FBUS_IR_FRAME_ID)*/) {
+ ((CurrentConnectionType==GCT_Infrared
+#ifndef UCLINUX
+ || CurrentConnectionType==GCT_Tekram
+#endif /* UCLINUX */
+ ) && rx_byte == FBUS_IR_FRAME_ID)) {
BufferCount = 0;
CurrentConnectionType=GCT_FBUS;
break;
+#endif /* UCLINUX */
case GCT_Infrared:
/* It's more complicated and not done here */
break;
+#ifndef UCLINUX
case GCT_Tekram:
/* It's more complicated and not done here */
fi
fi
export CPPFLAGS="-DUCLINUX=1 $CPPFLAGS"
-./configure --with-cfg-model=5110 --with-cfg-port=/dev/"$cfg_port" --without-x \
+./configure --with-cfg-model=6150 --with-cfg-port=/dev/"$cfg_port" --without-x \
`if [ -n "$enable_debug" ];then echo "--enable-debug --enable-xdebug";fi`
make clean
make
fprintf(stdout, _(" usage: gnokii [--help] [--version]\n"
));
+
+#ifdef UCLINUX
+ fprintf(stdout, _(
+" gnokii --ir <command> [<command args>...]\n"
+ ));
+#endif /* UCLINUX */
+
#ifndef UCLINUX
+ fprintf(stdout, _(
" gnokii --monitor [-noloop|-nl]\n"
));
#endif /* UCLINUX */
{
int c, i, rc = -1;
- int nargc = argc-2;
+ int nargc;
char **nargv;
/* Every option should be in this array. */
if (CFG_ReadConfig(&model, &Port, &Initlength, &Connection, &BinDir, false) < 0) {
exit(-1);
}
+ if (argc>1 && !strcmp(argv[1],"--ir")) {
+ argc--;
+ argv[1]=argv[0];
+ argv++;
+ Connection="infrared";
+ }
/* Handle command line arguments. */
if((nargv = malloc(sizeof(char *) * argc)) != NULL) {
+ nargc = argc-2;
for(i = 2; i < argc; i++)
nargv[i-2] = argv[i];
nargv[argc-2] = NULL; /* required by gnokiid() for execv(3) */
static int gnokiid(int argc, char *argv[])
{
bool DebugMode; /* When true, run in debug mode */
- char *Model; /* Model from .gnokiirc file. */
- char *Port; /* Port from .gnokiirc file */
- char *Initlength; /* Init length from .gnokiirc file */
- char *Connection; /* Connection type from .gnokiirc file */
- char *BinDir; /* Directory of the mgnokiidev command */
/* evaluate for presence of "--debug" argument in parameter */
DebugMode = false;
fprintf (stderr, _("Initializing gnokiid mode...\n"));
#endif
- if (CFG_ReadConfig(&Model, &Port, &Initlength, &Connection, &BinDir, true) < 0)
- return(-1);
-
- if (VM_Initialise(Model, Port, Initlength, GCT_FBUS, BinDir, DebugMode, true, ""/*SynchronizeTime*/) == false)
+ if (VM_Initialise(model, Port, Initlength, GetConnectionTypeFromString(Connection), BinDir, DebugMode, true, ""/*SynchronizeTime*/) == false)
return (-1);
if (argc>0) {
IR (only with 61x0 models) and MBUS (61x0, 640, 6160) */
typedef enum {
GCT_FBUS, /* FBUS connection. */
-#ifndef UCLINUX
GCT_Infrared, /* FBUS over direct infrared connection - 61xx. */
+#ifndef UCLINUX
GCT_Irda, /* FBUS over Irda sockets - 7110, 6210, etc. */
GCT_MBUS, /* MBUS */
GCT_DLR3, /* FBUS over DLR3 cable */