Forum Topic - Unable to make devctl calls on startup running Neutrino 6.3.2:
   
Unable to make devctl calls on startup running Neutrino 6.3.2  
we are having an issue with not being able to make devctl calls to a driver that we can get a file pointer to.

We are creating a driver like this:

               iofunc_attr_init(&attr, S_IFNAM | 0666, 0, 0);
               iofunc_func_init(_RESMGR_CONNECT_NFUNCS, &cfuncs, _RESMGR_IO_NFUNCS, &ifuncs);
               ifuncs.devctl = devctl_function;
               result = resmgr_attach(dpp, &resmgr_attr, "/dev/mydevice", _FTYPE_ANY, 0, &cfuncs, &ifuncs, &attr);

And using it in the start-up of another driver that loads later like this:

               fp = open( "/dev/mydevice", O_RDWR );
               if ( fp < 0 )
                              exit (EXIT_FAILURE);
               else {
                              result = devctl( fp, MY_DEVCTL, &my_message, sizeof(my_message), NULL );
                              if( err ) printf( "Error calling devctl: %s\n", strerror(err) );
               }

We will randomly see (maybe 1 in 4 start-ups) that it will say "Error calling devctl: No such device or address". And 
there are no errors returned by  devctl_function.

Note that most startups it works so it is not an issue with naming of the devctl or anything along those lines.
Is there anything that you can think of that could cause this, possibly along the lines of priorities or timing?
RE: Unable to make devctl calls on startup running Neutrino 6.3.2  
Sounds like there could be a race condition, do you have a waitfor /dev/mydevice prior to starting the other driver 
(assuming they're separate process)? Otherwise, if they're in the same application space you would need to ensure one 
driver is sufficiently initialized before starting the other.

-Joel

________________________________________
From: Ronald Mich [community-noreply@qnx.com]
Sent: Monday, July 07, 2014 11:21 AM
To: general-community
Subject: Unable to make devctl calls on startup running Neutrino 6.3.2

we are having an issue with not being able to make devctl calls to a driver that we can get a file pointer to.

We are creating a driver like this:

               iofunc_attr_init(&attr, S_IFNAM | 0666, 0, 0);
               iofunc_func_init(_RESMGR_CONNECT_NFUNCS, &cfuncs, _RESMGR_IO_NFUNCS, &ifuncs);
               ifuncs.devctl = devctl_function;
               result = resmgr_attach(dpp, &resmgr_attr, "/dev/mydevice", _FTYPE_ANY, 0, &cfuncs, &ifuncs, &attr);

And using it in the start-up of another driver that loads later like this:

               fp = open( "/dev/mydevice", O_RDWR );
               if ( fp < 0 )
                              exit (EXIT_FAILURE);
               else {
                              result = devctl( fp, MY_DEVCTL, &my_message, sizeof(my_message), NULL );
                              if( err ) printf( "Error calling devctl: %s\n", strerror(err) );
               }

We will randomly see (maybe 1 in 4 start-ups) that it will say "Error calling devctl: No such device or address". And 
there are no errors returned by  devctl_function.

Note that most startups it works so it is not an issue with naming of the devctl or anything along those lines.
Is there anything that you can think of that could cause this, possibly along the lines of priorities or timing?




_______________________________________________

General
http://community.qnx.com/sf/go/post110953
To cancel your subscription to this discussion, please e-mail general-community-unsubscribe@community.qnx.com