Adding a linux ioctl translation
Martin Laabs
mailinglists at martinlaabs.de
Mon Feb 18 13:24:05 UTC 2013
Hi,
I try to add some new ioctl in the linuxulator. These ioctls are for the
joystick driver I am currently writing.
I tried to modify the linux_ioctl.h and linux_ioctl.c in the kernel but up
to know I had no success.
I still get the dmesg output about unimplemented ioctls:
inux: pid 2830 (linux_jstest): ioctl fd=3, cmd=0x6a01 ('j',1) is not
implemented
linux(2830): ioctl(3, 80016a11, *)
linux: pid 2830 (linux_jstest): ioctl fd=3, cmd=0x6a11 ('j',17) is not
implemented
linux(2830): ioctl(3, 80016a12, *)
linux: pid 2830 (linux_jstest): ioctl fd=3, cmd=0x6a12 ('j',18) is not
implemented
linux(2830): ioctl(3, 80806a13, *)
linux: pid 2830 (linux_jstest): ioctl fd=3, cmd=0x6a13 ('j',19) is not
implemented
I did the following:
1. Add the original ioctls to the linux_ioctl.h
#define LINUX_JSIOCGVERSION 0x6a01 /*0x80046a01*/
#define LINUX_JSIOCGAXES 0x6a11 /*0x80016a11*/
#define LINUX_JSIOCGBUTTONS 0x6a12 /*0x80016a12*/
#define LINUX_JSIOCGNAME 0x6a13 /*0x80006a13*/
#define LINUX_JS_MIN 0x6a01
#define LINUX_JS_MAX 0x6a13
2. Modified the linux_ioctl.c by adding:
static linux_ioctl_function_t linux_ioctl_joystick;
[...]
static struct linux_ioctl_handler joystick_handler =
{linux_ioctl_joystick, LINUX_JS_MIN, LINUX_JS_MAX };
[...]
DATA_SET(linux_ioctl_handler_set, joystick_handler);
static int
linux_ioctl_joystick(struct thread *td, struct linux_ioctl_args *args)
{
int error;
error = 0;
printf(ARGS(ioctl, "%d, %04lx, *"), args->fd, \
(unsigned long)args->cmd);
switch (args->cmd) {
case LINUX_JSIOCGVERSION: args->cmd = JSIOCGVERSION; break;
case LINUX_JSIOCGAXES: args->cmd = JSIOCGAXES; break;
case LINUX_JSIOCGBUTTONS: args->cmd = JSIOCGBUTTONS; break;
case LINUX_JSIOCGNAME: args->cmd = JSIOCGNAME(0); break;
default: return (ENOIOCTL);
}
error = sys_ioctl(td, (struct ioctl_args *)args);
return (error);
}
3. Recompile linux.ko, restart the system
Unfortunately this did not what it should. I still get the message about
the unimplemented ioctl.
What did I miss?
Thank you,
Martin Laabs
More information about the freebsd-emulation
mailing list