ioctl entries for joystick in compat_ioctl.h
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi!
Quoted 9 lines
I wanted to use a joystick on my sparc64 workstation, and discovered that the joystick driver uses simple ioclt that are safe to pass from 32bit user space to 64bit kernel space. My patch adds the necessary entries in
compat_ioctl.h.There is only one missing ioctl in the patch. The ioctl is defined like this:
#define JSIOCGNAME(len)_IOC(_IOC_READ, 'j', 0x13, len)
so the command does not have a fixed value. I dont know how to handle this one, but it is only used to get the joystick name, all the applications I tried work well even if this ioctl fails.
Well, whoever invented that JSIOCGNAME should be shot. That is not single ioctl, its 2^14 of them!
Testing for CONFIG_INPUT_JOYDEV_MODULE looks like bad idea. AFAIR CONFIG_INPUT_JOYDEV_MODULE implies CONFIG_INPUT_JOYDEV. But this would mean that you can not insert joydev module into kernel compiled with JOYDEV=n. Perhaps it better to just simply kill the ifdef?
Vojtech, this fill be needed on x86-64, too. Can you take care of it?
Pavel
Quoted 36 lines
I have tested this patch with snes9x and
jstest.cwithout any problems.Regards,
Raphael Assenatfs/compat_ioctl.c Sun Sep 7 19:03:52 2003 renamed from fs/compat_ioctl.c Fri Aug 22 20:00:50 2003 +1
-1@@ -65,6 +65,7 @@ #include <linux/ctype.h> #include <linux/ioctl32.h> #include <linux/ncp_fs.h> +#include <linux/joystick.h> #include <net/sock.h> /* siocdevprivate_ioctl */ #include <net/bluetooth/bluetooth.h> --- linux-2.6.0-test4/include/linux/compat_ioctl.h Fri Aug 22 20:01:272003
+++linux-2.6.0-test4-raph/include/linux/compat_ioctl.hSun Sep 7 20:07:57 2003fs/compat_ioctl.c Sun Sep 7 19:03:52 2003 renamed from fs/compat_ioctl.c Fri Aug 22 20:00:50 2003 +13
-0@@ -680,3 +680,16 @@ COMPATIBLE_IOCTL(NBD_PRINT_DEBUG) COMPATIBLE_IOCTL(NBD_SET_SIZE_BLOCKS) COMPATIBLE_IOCTL(NBD_DISCONNECT) + +/* little j */ +#if defined(CONFIG_INPUT_JOYDEV)||defined(CONFIG_INPUT_JOYDEV_MODULE) +COMPATIBLE_IOCTL(JSIOCGVERSION) +COMPATIBLE_IOCTL(JSIOCGAXES) +COMPATIBLE_IOCTL(JSIOCGBUTTONS) +COMPATIBLE_IOCTL(JSIOCSCORR) +COMPATIBLE_IOCTL(JSIOCGCORR) +COMPATIBLE_IOCTL(JSIOCSAXMAP) +COMPATIBLE_IOCTL(JSIOCGAXMAP) +COMPATIBLE_IOCTL(JSIOCSBTNMAP) +COMPATIBLE_IOCTL(JSIOCGBTNMAP) +#endif
Signature · 2 lines
When do you have a heart between your knees? [Johanka's followup: and *two* hearts?]
Quoted 6 lines · Pavel Machek
Hi!
Quoted 4 lines
I wanted to use a joystick on my sparc64 workstation, and discovered that the joystick driver uses simple ioclt that are safe to pass from 32bit user space to 64bit kernel space. My patch adds the necessary entries in
compat_ioctl.h.
Quoted 8 lines
Quoted 5 lines
There is only one missing ioctl in the patch. The ioctl is defined like this:
#define JSIOCGNAME(len)_IOC(_IOC_READ, 'j', 0x13, len)
so the command does not have a fixed value. I dont know how to handle this one, but it is only used to get the joystick name, all the applications I tried work well even if this ioctl fails.Well, whoever invented that JSIOCGNAME should be shot. That is not single ioctl, its 2^14 of them!
Well, who could ever have known that this will be a problem in 1998? It's not the only ioctl done this way.
Quoted 6 lines
Testing for
CONFIG_INPUT_JOYDEV_MODULElooks like bad idea. AFAIRCONFIG_INPUT_JOYDEV_MODULEimpliesCONFIG_INPUT_JOYDEV. But this would mean that you can not insert joydev module into kernel compiled with JOYDEV=n. Perhaps it better to just simply kill the ifdef?Vojtech, this fill be needed on x86-64, too. Can you take care of it?
Yes, I will.
Quoted 40 lines
Quoted 36 lines
I have tested this patch with snes9x and
jstest.cwithout any problems.Regards,
Raphael Assenatfs/compat_ioctl.c Sun Sep 7 19:03:52 2003 renamed from fs/compat_ioctl.c Fri Aug 22 20:00:50 2003 +1
-1@@ -65,6 +65,7 @@ #include <linux/ctype.h> #include <linux/ioctl32.h> #include <linux/ncp_fs.h> +#include <linux/joystick.h> #include <net/sock.h> /* siocdevprivate_ioctl */ #include <net/bluetooth/bluetooth.h> --- linux-2.6.0-test4/include/linux/compat_ioctl.h Fri Aug 22 20:01:272003
+++linux-2.6.0-test4-raph/include/linux/compat_ioctl.hSun Sep 7 20:07:57 2003fs/compat_ioctl.c Sun Sep 7 19:03:52 2003 renamed from fs/compat_ioctl.c Fri Aug 22 20:00:50 2003 +13
-0@@ -680,3 +680,16 @@ COMPATIBLE_IOCTL(NBD_PRINT_DEBUG) COMPATIBLE_IOCTL(NBD_SET_SIZE_BLOCKS) COMPATIBLE_IOCTL(NBD_DISCONNECT) + +/* little j */ +#if defined(CONFIG_INPUT_JOYDEV)||defined(CONFIG_INPUT_JOYDEV_MODULE) +COMPATIBLE_IOCTL(JSIOCGVERSION) +COMPATIBLE_IOCTL(JSIOCGAXES) +COMPATIBLE_IOCTL(JSIOCGBUTTONS) +COMPATIBLE_IOCTL(JSIOCSCORR) +COMPATIBLE_IOCTL(JSIOCGCORR) +COMPATIBLE_IOCTL(JSIOCSAXMAP) +COMPATIBLE_IOCTL(JSIOCGAXMAP) +COMPATIBLE_IOCTL(JSIOCSBTNMAP) +COMPATIBLE_IOCTL(JSIOCGBTNMAP) +#endifSignature · 2 lines
When do you have a heart between your knees? [Johanka's followup: and *two* hearts?]
Signature · 2 lines
Vojtech Pavlik SuSE Labs, SuSE CR
Hi!
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
I wanted to use a joystick on my sparc64 workstation, and discovered that the joystick driver uses simple ioclt that are safe to pass from 32bit user space to 64bit kernel space. My patch adds the necessary entries in
compat_ioctl.h.There is only one missing ioctl in the patch. The ioctl is defined like this:
#define JSIOCGNAME(len)_IOC(_IOC_READ, 'j', 0x13, len)
so the command does not have a fixed value. I dont know how to handle this one, but it is only used to get the joystick name, all the applications I tried work well even if this ioctl fails.
Quoted 5 lines
Quoted 2 lines
Well, whoever invented that JSIOCGNAME should be shot. That is not single ioctl, its 2^14 of them!
Well, who could ever have known that this will be a problem in 1998? It's not the only ioctl done this way.
So it was you? :-)
I believe ultrasparcs were around in '98. Anyway, what are other ioctls doing this? They look pretty problematic from compat_ioctl perspective.
We could do better by pushing compat handler down to the drivers for ugly cases like this...
Pavel
Signature · 2 lines
When do you have a heart between your knees? [Johanka's followup: and *two* hearts?]
Quoted 10 lines · Pavel Machek
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
I wanted to use a joystick on my sparc64 workstation, and discovered that the joystick driver uses simple ioclt that are safe to pass from 32bit user space to 64bit kernel space. My patch adds the necessary entries in
compat_ioctl.h.There is only one missing ioctl in the patch. The ioctl is defined like this:
#define JSIOCGNAME(len)_IOC(_IOC_READ, 'j', 0x13, len)
so the command does not have a fixed value. I dont know how to handle this one, but it is only used to get the joystick name, all the applications I tried work well even if this ioctl fails.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Well, whoever invented that JSIOCGNAME should be shot. That is not single ioctl, its 2^14 of them!
Well, who could ever have known that this will be a problem in 1998? It's not the only ioctl done this way.
So it was you? :-)
Yes. :)
Quoted 3 lines
I believe ultrasparcs were around in '98. Anyway, what are other ioctls doing this? They look pretty problematic from
compat_ioctlperspective.
I don't remember - I know I just copied the concept from elsewhere. I'm sure you'll be able to grep for it.
Quoted 2 lines
We could do better by pushing compat handler down to the drivers for ugly cases like this...
Signature · 2 lines
Vojtech Pavlik SuSE Labs, SuSE CR
Quoted 12 lines · Vojtech Pavlik
Quoted 11 lines · Pavel Machek
Hi!
Quoted 9 lines · Raphael Assenat
I wanted to use a joystick on my sparc64 workstation, and discovered that the joystick driver uses simple ioclt that are safe to pass from 32bit user space to 64bit kernel space. My patch adds the necessary entries in
compat_ioctl.h.There is only one missing ioctl in the patch. The ioctl is defined like this:
#define JSIOCGNAME(len)_IOC(_IOC_READ, 'j', 0x13, len)
so the command does not have a fixed value. I dont know how to handle this one, but it is only used to get the joystick name, all the applications I tried work well even if this ioctl fails.
[...]
Quoted 31 lines
Quoted 31 lines
Vojtech, this fill be needed on x86-64, too. Can you take care of it?
I have tested this patch with snes9x and
jstest.cwithout any problems.Regards,
Raphael Assenatfs/compat_ioctl.c Sun Sep 7 19:03:52 2003 renamed from fs/compat_ioctl.c Fri Aug 22 20:00:50 2003 +1
-1@@ -65,6 +65,7 @@ #include <linux/ctype.h> #include <linux/ioctl32.h> #include <linux/ncp_fs.h> +#include <linux/joystick.h> #include <net/sock.h> /* siocdevprivate_ioctl */ #include <net/bluetooth/bluetooth.h> --- linux-2.6.0-test4/include/linux/compat_ioctl.h Fri Aug 22 20:01:272003
+++linux-2.6.0-test4-raph/include/linux/compat_ioctl.hSun Sep 7 20:07:57 2003fs/compat_ioctl.c Sun Sep 7 19:03:52 2003 renamed from fs/compat_ioctl.c Fri Aug 22 20:00:50 2003 +5
-0@@ -680,3 +680,16 @@ COMPATIBLE_IOCTL(NBD_PRINT_DEBUG) COMPATIBLE_IOCTL(NBD_SET_SIZE_BLOCKS) COMPATIBLE_IOCTL(NBD_DISCONNECT) + +/* little j */ +#if defined(CONFIG_INPUT_JOYDEV)||defined(CONFIG_INPUT_JOYDEV_MODULE) +COMPATIBLE_IOCTL(JSIOCGVERSION) +COMPATIBLE_IOCTL(JSIOCGAXES)
Quoted 8 lines
fs/compat_ioctl.c Sun Sep 7 19:03:52 2003 line 695
Quoted 8 lines
fs/compat_ioctl.c Sun Sep 7 19:03:52 2003 renamed from fs/compat_ioctl.c Fri Aug 22 20:00:50 2003 +8
-0+COMPATIBLE_IOCTL(JSIOCGBUTTONS) +COMPATIBLE_IOCTL(JSIOCSCORR) +COMPATIBLE_IOCTL(JSIOCGCORR) +COMPATIBLE_IOCTL(JSIOCSAXMAP) +COMPATIBLE_IOCTL(JSIOCGAXMAP) +COMPATIBLE_IOCTL(JSIOCSBTNMAP) +COMPATIBLE_IOCTL(JSIOCGBTNMAP) +#endif
I notice that this patch does not appear in current kernels, and the joystick doesn't work for 32-bit apps on x86-64. Did this patch ever make it into the kernel? Or some replacement? If not, what's the problem?
Thanks,
J