Wim Hellenthal
01/16/2010 9:29 AM
post45357
|
I've created a char device and I'm now trying to control the device usign io-devctl messages. I created a header file
with some command definitions. It looks as follows:
#ifndef CTL_H_
#define CTL_H_
typedef struct _CTLArg
{
bool b[16]; /* 16 general purpose boolean parameters */
int i[16]; /* 16 general purpose integer parameters */
float f[16]; /* 16 general purpose float parameters */
} CTLArg, *PCTLArg;
#define COMMAND_BASE 1 /*!< Command base for devctl messages */
#define DEVCTL_TEST __DION(_DCMD_MISC, COMMAND_BASE + 0)
#define DEVCTL_GET_EMULATION_MODE __DIOF(_DCMD_ALL, COMMAND_BASE + 1, CTLArg)
#define DEVCTL_SET_EMULATION_MODE __DIOT(_DCMD_ALL, COMMAND_BASE + 2, CTLArg)
#endif /*CTL_H_*/
I also created a test project that looks like the attached test.cpp file. The problem is hat no matter what I try the
devctl routine always returns ENOTTY. The device driver does call the hooked 'connect_funcs.open' and 'io_funcs.
close_dup' but the hooked 'io_funcs.devctl' function is never called. I looked at several examples and it looks like the
protection an so is correct. e.g. using:
iofunc_attr_init ((iofunc_attr_t*)&dev_attr[idx], _S_IFCHR | 0666, NULL, NULL);
I also tried other device types as _S_ IFNAM and _S_IFREG, all with the same negative result. I'm getting pretty
desperate since I have no clue why things are not working.
Hopefully someone knows what is going one here
Best regards
Wim
|
|
|