Commit 47769602 authored by Arne Øslebø's avatar Arne Øslebø
Browse files

addod POS support for offline devices

git-svn-id: file:///home/svn/mapi/trunk@882 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 27c93270
......@@ -230,6 +230,7 @@ mapidrv_offline_proc_loop(int devid)
{
char buf[BUFSIZE];
char *b=buf;
dag_record_t *rec;
int left=0,c;
dag_instance_t *i=flist_get(devlist,devid);
int err;
......@@ -245,6 +246,27 @@ mapidrv_offline_proc_loop(int devid)
ERROR_CMD(fprintf(stderr, "pthread_setcancelstate (%s) failed [%s:%d]\n",strerror(err),__FILE__,__LINE__));
return;
}
//Read first record to determine link type
c=read(i->file,b,BUFSIZE);
if(c<1) {
ERROR_CMD(fprintf(stderr, "Error reading first DAG record from file [%s:%d]\n",__FILE__,__LINE__));
return;
}
rec = (dag_record_t *) b;
switch(rec->type) {
case TYPE_HDLC_POS:
i->hwinfo.link_type=DLT_CHDLC;
break;
case TYPE_ETH:
i->hwinfo.link_type=DLT_EN10MB;
break;
default:
ERROR_CMD(fprintf(stderr, "Unsupported file format [%s:%d]\n",__FILE__,__LINE__));
return;
}
lseek(i->file,0,SEEK_SET);
c=read(i->file,b,BUFSIZE);
while(c>0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment