View topic - registering a network device

registering a network device

General Help about QNX

registering a network device

Postby priyanka » Thu Oct 08, 2009 7:16 am

in my driver i'm trying to register the network device using network ddk api's .
During the call to reg i get an error of operation not permitted.
So how to resolve this error or what is the source for this error.

my code is as follows.

int net_device_reg(usb_to_eth_t *drv, io_net_self_t *ion, void *dll_hdl)
{
int ret,errno;
printf("call to register net device\n");


if(net_device_config(drv) != EOK)
perror("could not configure device\n");
else
{
ret= drv->ion->reg(dll_hdl, &usb_to_eth_entry, &drv->reg_hdl, &drv->cell, &drv->lan_no);
printf("error no: %d\n",errno);
printf("\nreturn val %d\n",ret);
if(ret < 0)
{
perror("the error is:\n");
return -1;
}
else
{
// printf("net device registered\n");
printf("interface returned: %d\n ",drv->lan_no);
printf("cell no: %d\n ",drv->cell);
printf("interface allocated: %d\n ",drv->cfg.lan);
return 0;
}
}
return 0;
}
priyanka
Active Member
 
Posts: 11
Joined: Thu Jul 16, 2009 4:42 am

Postby Tim » Thu Oct 08, 2009 1:09 pm

Priyanka,

I've never used the network DDK but this sounds like your program doesn't have the right privileges.

Even if you are running as root some I/O operations specifically must make a ThreadCtrl() call in order to access hardware/memory.

The documentation for the net_device_reg() call should mention this.

Tim
Tim
Senior Member
 
Posts: 1511
Joined: Wed Mar 10, 2004 12:28 am

Postby maschoen » Thu Oct 08, 2009 3:29 pm

Are you running as root?
maschoen
QNX Master
 
Posts: 2724
Joined: Wed Jun 25, 2003 5:18 pm

Postby priyanka » Fri Oct 09, 2009 4:32 am

yes i'm running as root.
i also tried using Thread_ctl but of no use.

int net_device_reg(usb_to_eth_t *drv, io_net_self_t *ion, void *dll_hdl)
{
int ret,errno,ret1;
printf("call to register net device\n");


if(net_device_config(drv) != EOK)
perror("could not configure device\n");
else
{
ret1=ThreadCtl(_NTO_TCTL_IO, 0);
printf("thread ctl ret= %d",ret1);
ret = drv->ion->reg(dll_hdl, &usb_to_eth_entry, &drv->reg_hdl, &drv->cell, &drv->lan_no);
printf("error no: %d\n",errno);
printf("\nreturn val %d\n",ret);
if(ret < 0)
{
perror("the error is:\n");
return -1;
}
else
{
// printf("net device registered\n");
printf("interface returned: %d\n ",drv->lan_no);
printf("cell no: %d\n ",drv->cell);
printf("interface allocated: %d\n ",drv->cfg.lan);
return 0;
}
}
return 0;
}

It gave the same error.
priyanka
Active Member
 
Posts: 11
Joined: Thu Jul 16, 2009 4:42 am


Return to Help

Who is online

Users browsing this forum: No registered users and 2 guests

cron