Linux Force Feedback for Saitek Cyborg Evo Force
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines · Johannes Ebke
I own a Saitek Cyborg Evo Force which works fine with the HID driver on Linux. However, i could not find a force feedback driver for it, and just adding the USB id and spec to the IForce driver does not work (and crashes the kernel)
Hi Johannes,
thanks for your e-mail. I hope you don't mind adding a few relevant CCs.
First, kernel crashing means that we are probably lacking some error handling in the iforce driver, which we should add if possible. Could you please post the oops message preceeding the crash?
Quoted 5 lines
After that, I have reverse-engineered the protocol using usb snoops from a kvm virtual machine with XP on it. Using libusb, I have verified that I understand the protocol, and it actually looks quite similar to the iforce protocol (no wonder, it just implements the DirectInput interface in hardware)
Good job, thanks a lot for doing this.
Quoted 3 lines
My question: Would it make sense to adapt the iforce modules to include this slightly modified protocol (other initialization strings, other magic bytes) or would it be better to copy & modify?
It really depends how much different the protocols really are. iforce driver currently doesn't support any per-device flags which would allow for introducing slight differences between individual models.
Maybe it would help if you could just summarize the most important differences to iforce protocol, so that we could see what aproach would be the best.
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs, Novell Inc.
Hi Jiri,
I have looked into the problems some more, and have found that the cause of the crash was a change I made because I misunderstood the code (LO(cmd) is the number of bytes in in the message, and is not transferred on USB - i had removed it from the message...)
First, the changes in the normal input, the joystick axis+buttons message:
* Prefix is 0x06 instead of 0x01 (joystick) or 0x03 (gamepad)
* Throttle is not inverted (data[4] instead of 255-data[4])
* Rudder is present and unsigned (not signed, as in iforce)
I have attached a patch that I think fixes this (it works for me :) Since saitek uses a different protocol byte, this can be done without adding per-device flags to the driver.
It also adds a button map btn_saitek_cyborg that switches button 1&2 to make the button number the same as printed on the device, and abs_saitek_cyborg for a joystick with rudder but only one hat.
The fftest effects seem to work, but some are feeble and feel strange - I suspect there are some subtle changes, for example I am quite sure that the Saitek uses signed (twos complement) numbers for effect strength (this could perhaps explain the 'strange' behavior for 0x80 byte values in the current code)...
Cheers,
Johannes
Quoted 31 lines · Jiri Kosina
Quoted 4 lines · Johannes Ebke
I own a Saitek Cyborg Evo Force which works fine with the HID driver on Linux. However, i could not find a force feedback driver for it, and just adding the USB id and spec to the IForce driver does not work (and crashes the kernel)
Hi Johannes,
thanks for your e-mail. I hope you don't mind adding a few relevant CCs.
First, kernel crashing means that we are probably lacking some error handling in the iforce driver, which we should add if possible. Could you please post the oops message preceeding the crash?
Quoted 5 lines
After that, I have reverse-engineered the protocol using usb snoops from a kvm virtual machine with XP on it. Using libusb, I have verified that I understand the protocol, and it actually looks quite similar to the iforce protocol (no wonder, it just implements the DirectInput interface in hardware)
Good job, thanks a lot for doing this.
Quoted 3 lines
My question: Would it make sense to adapt the iforce modules to include this slightly modified protocol (other initialization strings, other magic bytes) or would it be better to copy & modify?
It really depends how much different the protocols really are. iforce driver currently doesn't support any per-device flags which would allow for introducing slight differences between individual models.
Quoted 6 lines
Maybe it would help if you could just summarize the most important differences to iforce protocol, so that we could see what aproach would be the best.
Thanks,
iforce-main.c +8 -0
@@ -35,6 +35,10 @@ {BTN_TRIGGER ,BTN_TOP ,BTN_THUMB ,BTN_TOP2 ,BTN_BASE , BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_BASE5, BTN_A, BTN_B, BTN_C, -1 }; +static signed short btn_saitek_cyborg[] = +{BTN_TRIGGER ,BTN_THUMB ,BTN_TOP ,BTN_TOP2 ,BTN_BASE , +BTN_BASE2 ,BTN_BASE3 ,BTN_BASE4 ,BTN_BASE5 ,BTN_A ,BTN_B ,BTN_C ,-1 }; +static signed short btn_avb_pegasus[] = {BTN_TRIGGER ,BTN_TOP ,BTN_THUMB ,BTN_TOP2 ,BTN_BASE ,BTN_BASE2 ,BTN_BASE3 ,BTN_BASE4 ,-1 };
@@ -54,6 +58,9 @@static signed short abs_joystick[] = {ABS_X ,ABS_Y ,ABS_THROTTLE ,ABS_HAT0X ,ABS_HAT0Y ,-1 }; +static signed short abs_saitek_cyborg[] = +{ABS_X ,ABS_Y ,ABS_THROTTLE ,ABS_RUDDER ,ABS_HAT0X ,ABS_HAT0Y ,-1 }; +static signed short abs_avb_pegasus[] = {ABS_X ,ABS_Y ,ABS_THROTTLE ,ABS_RUDDER ,ABS_HAT0X ,ABS_HAT0Y ,ABS_HAT1X ,ABS_HAT1Y ,-1 };
@@ -79,6 +86,7 @@ { 0x06f8, 0x0004, "Guillemot Force Feedback Racing Wheel", btn_wheel, abs_wheel, ff_iforce }, //? { 0x06f8, 0x0004, "Gullemot Jet Leader 3D", btn_joystick, abs_joystick, ff_iforce }, //? { 0x06d6, 0x29bc, "Trust Force Feedback Race Master", btn_wheel, abs_wheel, ff_iforce }, + { 0x06a3, 0xffb5, "Saitek Cyborg Evo Force", btn_saitek_cyborg, abs_saitek_cyborg, ff_iforce }, //? { 0x0000, 0x0000, "Unknown I-Force Device [%04x:%04x]", btn_joystick, abs_joystick, ff_iforce } };
iforce-packets.c +15 -7
@@ -182,16 +182,24 @@case 0x01 :/* joystick position data */ case 0x03 :/* wheel position data */ -if (HI (cmd) ==1 ) { -input_report_abs (dev,ABS_X , (__s16) (((__s16 )data[1 ] <<8 ) | data[0 ])); -input_report_abs (dev,ABS_Y , (__s16) (((__s16 )data[3 ] <<8 ) | data[2 ])); -input_report_abs (dev,ABS_THROTTLE ,255 - data[4 ]); -if (LO (cmd) >=8 &&test_bit (ABS_RUDDER ,dev->absbit)) -input_report_abs (dev,ABS_RUDDER , (__s8 )data[7 ]); - }else { +case 0x06 :/* saitek position data */ +if (HI (cmd) ==3 ) {input_report_abs (dev,ABS_WHEEL , (__s16) (((__s16 )data[1 ] <<8 ) | data[0 ]));input_report_abs (dev,ABS_GAS ,255 - data[2 ]);input_report_abs (dev,ABS_BRAKE ,255 - data[3 ]); + }else { +input_report_abs (dev,ABS_X , (__s16) (((__s16 )data[1 ] <<8 ) | data[0 ])); +input_report_abs (dev,ABS_Y , (__s16) (((__s16 )data[3 ] <<8 ) | data[2 ])); +if (HI (cmd) ==6 ) { +input_report_abs (dev,ABS_THROTTLE , data[4 ]); +if (LO (cmd) >=8 &&test_bit (ABS_RUDDER ,dev->absbit)) +input_report_abs (dev,ABS_RUDDER , data[7 ]); + }else { +input_report_abs (dev,ABS_THROTTLE ,255 - data[4 ]); +if (LO (cmd) >=8 &&test_bit (ABS_RUDDER ,dev->absbit)) +input_report_abs (dev,ABS_RUDDER , (__s8 )data[7 ]); + } + }input_report_abs (dev,ABS_HAT0X , iforce_hat_to_axis[data[6 ] >>4 ].x);
iforce-usb.c +1 -0
@@ -227,6 +227,7 @@ { USB_DEVICE(0x06f8, 0x0001) }, /* Guillemot Race Leader Force Feedback */ { USB_DEVICE(0x06f8, 0x0004) }, /* Guillemot Force Feedback Racing Wheel */ { USB_DEVICE(0x06f8, 0xa302) }, /* Guillemot Jet Leader 3D */ + { USB_DEVICE(0x06a3, 0xffb5) }, /* Saitek Cyborg Evo Force */ { } /* Terminating entry */ };
Hi,
...it worked in the jscalibrator, but in the game I noticed that the axis ranges (as given by the HID driver, which also works for non-ff mode) are different to the iforce ones:
x/y is from 0 (top, left, rudder left) to 4096 (bottom right) or 255 (rudder right), and throttle is from 255 (no throttle) to 0 (full)
In iforce the x-range is from -1920 to 1920, so 256 steps less than the saitek range...
This is a bit more difficult to fit into the driver framework, because the ranges are set in the initialization routine in iforce-main.c. I'll put an if() in there for starters.
Cheers,
Johannes
Quoted 65 lines · Johannes Ebke
Hi Jiri,
I have looked into the problems some more, and have found that the cause of the crash was a change I made because I misunderstood the code (LO(cmd) is the number of bytes in in the message, and is not transferred on USB - i had removed it from the message...)
First, the changes in the normal input, the joystick axis+buttons message:
* Prefix is0x06instead of0x01(joystick) or0x03(gamepad)
* Throttle is not inverted (data[4] instead of 255-data[4])
* Rudder is present and unsigned (not signed, as in iforce)I have attached a patch that I think fixes this (it works for me :) Since saitek uses a different protocol byte, this can be done without adding per-device flags to the driver.
It also adds a button map
btn_saitek_cyborgthat switches button 1&2 to make the button number the same as printed on the device, andabs_saitek_cyborgfor a joystick with rudder but only one hat.The fftest effects seem to work, but some are feeble and feel strange - I suspect there are some subtle changes, for example I am quite sure that the Saitek uses signed (twos complement) numbers for effect strength (this could perhaps explain the 'strange' behavior for
0x80byte values in the current code)...Cheers,
JohannesQuoted 34 lines · Jiri Kosina
Quoted 4 lines · Johannes Ebke
I own a Saitek Cyborg Evo Force which works fine with the HID driver on Linux. However, i could not find a force feedback driver for it, and just adding the USB id and spec to the IForce driver does not work (and crashes the kernel)
Hi Johannes,
thanks for your e-mail. I hope you don't mind adding a few relevant CCs.
First, kernel crashing means that we are probably lacking some error handling in the iforce driver, which we should add if possible. Could you please post the oops message preceeding the crash?
Quoted 5 lines
After that, I have reverse-engineered the protocol using usb snoops from a kvm virtual machine with XP on it. Using libusb, I have verified that I understand the protocol, and it actually looks quite similar to the iforce protocol (no wonder, it just implements the DirectInput interface in hardware)
Good job, thanks a lot for doing this.
Quoted 3 lines
My question: Would it make sense to adapt the iforce modules to include this slightly modified protocol (other initialization strings, other magic bytes) or would it be better to copy & modify?
It really depends how much different the protocols really are. iforce driver currently doesn't support any per-device flags which would allow for introducing slight differences between individual models.
Maybe it would help if you could just summarize the most important differences to iforce protocol, so that we could see what aproach would be the best.
Thanks,
Quoted 4 lines · Johannes Ebke
I have looked into the problems some more, and have found that the cause of the crash was a change I made because I misunderstood the code (LO(cmd) is the number of bytes in in the message, and is not transferred on USB - i had removed it from the message...)
Ah, good, thanks.
Quoted 13 lines
First, the changes in the normal input, the joystick axis+buttons message:
* Prefix is0x06instead of0x01(joystick) or0x03(gamepad)
* Throttle is not inverted (data[4] instead of 255-data[4])
* Rudder is present and unsigned (not signed, as in iforce)I have attached a patch that I think fixes this (it works for me :) Since saitek uses a different protocol byte, this can be done without adding per-device flags to the driver.
It also adds a button map
btn_saitek_cyborgthat switches button 1&2 to make the button number the same as printed on the device, andabs_saitek_cyborgfor a joystick with rudder but only one hat.
Quoted 5 lines
The fftest effects seem to work, but some are feeble and feel strange - I suspect there are some subtle changes, for example I am quite sure that the Saitek uses signed (twos complement) numbers for effect strength (this could perhaps explain the 'strange' behavior for
0x80byte values in the current code)...
The changes look really minimal to me, so I'd propose just to add a few special cases to the iforce driver itself (probably by setting/checking some per-device flag where needed), rather than copy/pasting the whole iforce driver.
But the ultimate decision is on Dmitry (CCed) here.
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs, Novell Inc.
Dmitry Torokhov
maintainerQuoted 28 lines · Jiri Kosina
Quoted 4 lines · Johannes Ebke
I have looked into the problems some more, and have found that the cause of the crash was a change I made because I misunderstood the code (LO(cmd) is the number of bytes in in the message, and is not transferred on USB - i had removed it from the message...)
Ah, good, thanks.
Quoted 13 lines
First, the changes in the normal input, the joystick axis+buttons message:
* Prefix is0x06instead of0x01(joystick) or0x03(gamepad)
* Throttle is not inverted (data[4] instead of 255-data[4])
* Rudder is present and unsigned (not signed, as in iforce)I have attached a patch that I think fixes this (it works for me :) Since saitek uses a different protocol byte, this can be done without adding per-device flags to the driver.
It also adds a button map
btn_saitek_cyborgthat switches button 1&2 to make the button number the same as printed on the device, andabs_saitek_cyborgfor a joystick with rudder but only one hat.Quoted 5 lines
The fftest effects seem to work, but some are feeble and feel strange - I suspect there are some subtle changes, for example I am quite sure that the Saitek uses signed (twos complement) numbers for effect strength (this could perhaps explain the 'strange' behavior for
0x80byte values in the current code)...
Quoted 7 lines
The changes look really minimal to me, so I'd propose just to add a few special cases to the iforce driver itself (probably by setting/checking some per-device flag where needed), rather than copy/pasting the whole iforce driver.
But the ultimate decision is on Dmitry (CCed) here.
Right, so far I have not seen anythig that would warrant creating a separate driver, adjusting the current one is the way to go.
Signature · 1 line
Dmitry
Hi,
It seems that the force feedback works well, I have ported the force feedback for my favorite game to linux now, and it works well.
What does not work is updating effects - there just nothing happens, and the old event is played. I have circumvented this by deleting/re-uploading the effect, but this should probably been made to work. Does it work well with other hardware?
Thirdly, I have re-discovered one kernel oops that occurs if the joystick is unplugged if some process still has the event device open. Steps to reproduce:
* plug joystick in
* fftest /dev/input/eventXX
* unplug joystick
(kern.log extract attached)
Sometimes this just gives an oops, sometimes it escalates into a kernel panic.
Finally, attached is the most recent patch (saitek-v2.patch):
* handling of 0x06 (saitek?) message format for axis/button data
* Saitek Cyborg Evo Force button+axis definitions and table entry
* Changes axis limits if hardware is from Saitek
* Added has_btndead to iforce_device + table entries
* Only add BTN_DEAD if iforce device has_btndead
(since my joystick does not have a physical dead switch)
The patch is against 2.6.32 from kernel.org.
Cheers,
Johannes
Quoted 32 lines · Dmitry Torokhov
Quoted 31 lines · Jiri Kosina
Quoted 4 lines · Johannes Ebke
I have looked into the problems some more, and have found that the cause of the crash was a change I made because I misunderstood the code (LO(cmd) is the number of bytes in in the message, and is not transferred on USB - i had removed it from the message...)
Ah, good, thanks.
Quoted 13 lines
First, the changes in the normal input, the joystick axis+buttons message:
* Prefix is0x06instead of0x01(joystick) or0x03(gamepad)
* Throttle is not inverted (data[4] instead of 255-data[4])
* Rudder is present and unsigned (not signed, as in iforce)I have attached a patch that I think fixes this (it works for me :) Since saitek uses a different protocol byte, this can be done without adding per-device flags to the driver.
It also adds a button map
btn_saitek_cyborgthat switches button 1&2 to make the button number the same as printed on the device, andabs_saitek_cyborgfor a joystick with rudder but only one hat.Quoted 5 lines
The fftest effects seem to work, but some are feeble and feel strange - I suspect there are some subtle changes, for example I am quite sure that the Saitek uses signed (twos complement) numbers for effect strength (this could perhaps explain the 'strange' behavior for
0x80byte values in the current code)...The changes look really minimal to me, so I'd propose just to add a few special cases to the iforce driver itself (probably by setting/checking some per-device flag where needed), rather than copy/pasting the whole iforce driver.
Quoted 6 lines
Quoted 2 lines
But the ultimate decision is on Dmitry (CCed) here.
Right, so far I have not seen anythig that would warrant creating a separate driver, adjusting the current one is the way to go.
Dec 19 23:42:17 localhost kernel: [ 154.444093] usb 6-1: new full speed USB device using uhci_hcd and address 2 Dec 19 23:42:17 localhost kernel: [ 154.600375] usb 6-1: New USB device found, idVendor=06a3, idProduct=ffb5 Dec 19 23:42:17 localhost kernel: [ 154.600384] usb 6-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Dec 19 23:42:17 localhost kernel: [ 154.600390] usb 6-1: Product: Cyborg Evo Force Dec 19 23:42:17 localhost kernel: [ 154.600394] usb 6-1: Manufacturer: Saitek Dec 19 23:42:17 localhost kernel: [ 154.600737] usb 6-1: configuration #1 chosen from 1 choice Dec 19 23:42:17 localhost kernel: [ 154.714158] drivers/input/joystick/iforce/iforce-packets.c: info cmd = ff01, data = 43 Dec 19 23:42:17 localhost kernel: [ 154.716162] drivers/input/joystick/iforce/iforce-packets.c: info cmd = ff03, data = 45 00 01 Dec 19 23:42:17 localhost kernel: [ 154.718368] drivers/input/joystick/iforce/iforce-packets.c: info cmd = ff01, data = 4f Dec 19 23:42:17 localhost kernel: [ 154.720155] drivers/input/joystick/iforce/iforce-packets.c: info cmd = ff04, data = 56 02 05 00 Dec 19 23:42:17 localhost kernel: [ 154.721032] input: Saitek Cyborg Evo Force as /devices/pci0000:00/0000:00:1d.0/usb6/6-1/input/input10 Dec 19 23:42:17 localhost kernel: [ 154.721642] usbcore: registered new interface driver iforce Dec 19 23:42:17 localhost kernel: [ 154.805812] usbcore: registered new interface driver hiddev Dec 19 23:42:17 localhost kernel: [ 154.805930] usbcore: registered new interface driver usbhid Dec 19 23:42:17 localhost kernel: [ 154.805934] usbhid: v2.6:USB HID core driver Dec 19 23:42:26 localhost kernel: [ 162.928977] drivers/input/joystick/iforce/iforce-packets.c: magnitude: cmd = 0303, data = 1a 00 20 Dec 19 23:42:26 localhost kernel: [ 162.928993] drivers/input/joystick/iforce/iforce-packets.c: condition cmd = 050a, data = 2a 00 19 19 00 00 00 00 31 31 Dec 19 23:42:26 localhost kernel: [ 162.929009] drivers/input/joystick/iforce/iforce-packets.c: condition cmd = 050a, data = 32 00 19 19 00 00 00 00 31 31 Dec 19 23:42:26 localhost kernel: [ 162.929028] drivers/input/joystick/iforce/iforce-packets.c: condition cmd = 050a, data = 3a 00 19 19 00 00 00 00 31 31 Dec 19 23:42:26 localhost kernel: [ 162.929044] drivers/input/joystick/iforce/iforce-packets.c: condition cmd = 050a, data = 42 00 19 19 00 00 00 00 31 31 Dec 19 23:42:49 localhost kernel: [ 185.954214] usb 6-1: USB disconnect, address 2 Dec 19 23:42:49 localhost kernel: [ 185.960338] BUG: unable to handle kernel paging request at 000032002a0000e7 Dec 19 23:42:49 localhost kernel: [ 185.960627] IP: [<ffffffff8128949b>] unlink1+0x3b/0x130 Dec 19 23:42:49 localhost kernel: [ 185.960810] PGD 0 Dec 19 23:42:49 localhost kernel: [ 185.960973] Oops: 0000 [#1] PREEMPT SMP Dec 19 23:42:49 localhost kernel: [ 185.961131] last sysfs file: /sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq Dec 19 23:42:49 localhost kernel: [ 185.961131] CPU 1 Dec 19 23:42:49 localhost kernel: [ 185.961131] Modules linked in: usbhid hid iforce fglrx(P) ipv6 openafs(P) cpufreq_stats kvm_intel kvm binfmt_misc uinput fuse radeonfb fb_ddc i2c_algo_bit i2c_core snd_hda_codec_atihdmi snd_hda_codec_analog arc4 snd_hda_intel ide_cs joydev ecb snd_hda_codec iwlagn iwlcore snd_pcm_oss pcmcia snd_mixer_oss uvcvideo yenta_socket psmouse video snd_pcm rsrc_nonstatic mac80211 serio_raw pcspkr wmi pcmcia_core snd_page_alloc output cfg80211 rfkill ext3 jbd mbcache sha256_generic cryptd aes_x86_64 aes_generic sg ricoh_mmc sdhci_pci sdhci led_class uhci_hcd intel_agp [last unloaded: scsi_wait_scan] Dec 19 23:42:49 localhost kernel: [ 185.964097] Pid: 336, comm: khubd Tainted: P 2.6.32-je3 #5 HP EliteBook 8530p Dec 19 23:42:49 localhost kernel: [ 185.964097] RIP: 0010:[<ffffffff8128949b>] [<ffffffff8128949b>] unlink1+0x3b/0x130 Dec 19 23:42:49 localhost kernel: [ 185.964097] RSP: 0018:ffff88007e087b60 EFLAGS: 00010202 Dec 19 23:42:49 localhost kernel: [ 185.964097] RAX: 000032002a00007f RBX: 0000000000000286 RCX: ffffffff8117aa43 Dec 19 23:42:49 localhost kernel: [ 185.964097] RDX: 00000000fffffffe RSI: ffff880061766000 RDI: ffff88006e10e000 Dec 19 23:42:49 localhost kernel: [ 185.964097] RBP: ffff88006e10e000 R08: ffff88000188f0e0 R09: 0000000000000000 Dec 19 23:42:49 localhost kernel: [ 185.964097] R10: 8000000000000000 R11: ffffffff81152eb0 R12: 00000000fffffffe Dec 19 23:42:49 localhost kernel: [ 185.964097] R13: ffffffffa00c4408 R14: ffff88006fe57800 R15: 0000000000000000 Dec 19 23:42:49 localhost kernel: [ 185.964097] FS: 0000000000000000(0000) GS:ffff880001880000(0000) knlGS:0000000000000000 Dec 19 23:42:49 localhost kernel: [ 185.964097] CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b Dec 19 23:42:49 localhost kernel: [ 185.964097] CR2: 000032002a0000e7 CR3: 000000005e823000 CR4: 00000000000026e0 Dec 19 23:42:49 localhost kernel: [ 185.964097] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 Dec 19 23:42:49 localhost kernel: [ 185.964097] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Dec 19 23:42:49 localhost kernel: [ 185.964097] Process khubd (pid: 336, threadinfo ffff88007e086000, task ffff88007e1c9ea0) Dec 19 23:42:49 localhost kernel: [ 185.964097] Stack: Dec 19 23:42:49 localhost kernel: [ 185.964097] 0000000000000286 ffff880061766000 00000000fffffffe ffffffffa00c4408 Dec 19 23:42:49 localhost kernel: [ 185.964097] <0> ffff88006fe57800 ffffffff812896f9 ffff880061766000 ffff88006e10e000 Dec 19 23:42:49 localhost kernel: [ 185.964097] <0> ffff880061766014 ffffffff8128ac2c ffff88005e98d808 ffffffff81179963 Dec 19 23:42:49 localhost kernel: [ 185.964097] Call Trace: Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff812896f9>] ? usb_hcd_unlink_urb+0x59/0xa0 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff8128ac2c>] ? usb_kill_urb+0x3c/0xc0 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff81179963>] ? kobject_del+0x23/0x30 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff8120ce3d>] ? device_del+0x17d/0x1d0 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffffa00c35bd>] ? iforce_usb_delete+0xd/0x40 [iforce] Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffffa00c3248>] ? iforce_usb_disconnect+0x48/0x70 [iforce] Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff8128ee54>] ? usb_unbind_interface+0x134/0x180 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff8120f5f2>] ? __device_release_driver+0x72/0xe0 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff8120f745>] ? device_release_driver+0x25/0x40 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff8120eae5>] ? bus_remove_device+0x95/0xd0 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff8120cdea>] ? device_del+0x12a/0x1d0 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff8128b955>] ? usb_disable_device+0x95/0x120 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff8128644b>] ? usb_disconnect+0xbb/0x150 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff81287291>] ? hub_thread+0x371/0x13a0 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff81037d90>] ? select_task_rq_fair+0x4b0/0x760 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff81036d25>] ? set_next_entity+0x35/0x70 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff81280100>] ? mmc_ioctl_dvd_read_struct+0x390/0x5c0 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff8139b849>] ? thread_return+0x243/0x65a Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff81059c80>] ? autoremove_wake_function+0x0/0x30 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff81286f20>] ? hub_thread+0x0/0x13a0 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff81286f20>] ? hub_thread+0x0/0x13a0 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff81059976>] ? kthread+0x96/0xa0 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff8100ce0a>] ? child_rip+0xa/0x20 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff810598e0>] ? kthread+0x0/0xa0 Dec 19 23:42:49 localhost kernel: [ 185.964097] [<ffffffff8100ce00>] ? child_rip+0x0/0x20 Dec 19 23:42:49 localhost kernel: [ 185.964097] Code: 24 10 4c 89 6c 24 18 4c 89 74 24 20 48 89 fd 48 8b 46 48 48 89 f3 41 89 d4 48 83 78 38 00 74 30 48 8b 87 f0 00 00 00 48 8b 1c 24 <4c> 8b 58 68 48 8b 6c 24 08 4c 8b 64 24 10 4c 8b 6c 24 18 4c 8b Dec 19 23:42:49 localhost kernel: [ 185.964097] RIP [<ffffffff8128949b>] unlink1+0x3b/0x130 Dec 19 23:42:49 localhost kernel: [ 185.964097] RSP <ffff88007e087b60> Dec 19 23:42:49 localhost kernel: [ 185.964097] CR2: 000032002a0000e7 Dec 19 23:42:49 localhost kernel: [ 185.977920] ---[ end trace fc8dfb59ff1c03b8 ]---
iforce.h +1 -0
@@ -96,6 +96,7 @@signed short *btn;signed short *abs;signed short *ff; +bool has_btndead; };struct iforce {
iforce-main.c +31 -16
83 lines not on this page · raw message
iforce-packets.c +19 -9
@@ -182,16 +182,24 @@case 0x01 :/* joystick position data */ case 0x03 :/* wheel position data */ -if (HI (cmd) ==1 ) { -input_report_abs (dev,ABS_X , (__s16) (((__s16 )data[1 ] <<8 ) | data[0 ])); -input_report_abs (dev,ABS_Y , (__s16) (((__s16 )data[3 ] <<8 ) | data[2 ])); -input_report_abs (dev,ABS_THROTTLE ,255 - data[4 ]); -if (LO (cmd) >=8 &&test_bit (ABS_RUDDER ,dev->absbit)) -input_report_abs (dev,ABS_RUDDER , (__s8 )data[7 ]); - }else { +case 0x06 :/* saitek position data */ +if (HI (cmd) ==3 ) {input_report_abs (dev,ABS_WHEEL , (__s16) (((__s16 )data[1 ] <<8 ) | data[0 ]));input_report_abs (dev,ABS_GAS ,255 - data[2 ]);input_report_abs (dev,ABS_BRAKE ,255 - data[3 ]); + }else { +input_report_abs (dev,ABS_X , (__s16) (((__s16 )data[1 ] <<8 ) | data[0 ])); +input_report_abs (dev,ABS_Y , (__s16) (((__s16 )data[3 ] <<8 ) | data[2 ])); +if (HI (cmd) ==6 ) { +input_report_abs (dev,ABS_THROTTLE , data[4 ]); +if (LO (cmd) >=8 &&test_bit (ABS_RUDDER ,dev->absbit)) +input_report_abs (dev,ABS_RUDDER , data[7 ]); + }else { +input_report_abs (dev,ABS_THROTTLE ,255 - data[4 ]); +if (LO (cmd) >=8 &&test_bit (ABS_RUDDER ,dev->absbit)) +input_report_abs (dev,ABS_RUDDER , (__s8 )data[7 ]); + } + }input_report_abs (dev,ABS_HAT0X , iforce_hat_to_axis[data[6 ] >>4 ].x);
@@ -220,8 +228,10 @@break ;case 0x02 :/* status report */ -input_report_key (dev,BTN_DEAD , data[0 ] &0x02 ); -input_sync (dev); +if (iforce->type->has_btndead) { +input_report_key (dev,BTN_DEAD , data[0 ] &0x02 ); +input_sync (dev); + }/* Check if an effect was just started or stopped */ i = data[1 ] &0x7f ;
iforce-usb.c +1 -0
@@ -227,6 +227,7 @@ { USB_DEVICE(0x06f8, 0x0001) }, /* Guillemot Race Leader Force Feedback */ { USB_DEVICE(0x06f8, 0x0004) }, /* Guillemot Force Feedback Racing Wheel */ { USB_DEVICE(0x06f8, 0xa302) }, /* Guillemot Jet Leader 3D */ + { USB_DEVICE(0x06a3, 0xffb5) }, /* Saitek Cyborg Evo Force */ { } /* Terminating entry */ };
* Johannes Ebke -- Sunday 20 December 2009:
Quoted 2 lines
It seems that the force feedback works well, I have ported the force feedback for my favorite game to linux now, and it works well.
How do you handle joystick calibration? Or does your js not need that? Mine does, and it looks like I can either have a working (= calibrated) js (/dev/input/js?), *or* ff (/dev/input/event?), which is rather unfortunate.
m.
Dmitry Torokhov
maintainerQuoted 17 lines · Johannes Ebke
Hi,
It seems that the force feedback works well, I have ported the force feedback for my favorite game to linux now, and it works well.
What does not work is updating effects - there just nothing happens, and the old event is played. I have circumvented this by deleting/re-uploading the effect, but this should probably been made to work. Does it work well with other hardware?
Thirdly, I have re-discovered one kernel oops that occurs if the joystick is unplugged if some process still has the event device open. Steps to reproduce:
* plug joystick in
* fftest/dev/input/eventXX
* unplug joystick
Quoted 5 lines
(kern.log extract attached)
Sometimes this just gives an oops, sometimes it escalates into a kernel panic.
Hmm, it looks like iforce unbinding is completely busted:
static void iforce_usb_disconnect(struct usb_interface *intf)
{
struct iforce *iforce = usb_get_intfdata(intf);
int open = 0; /* FIXME! iforce->dev.handle->open; */^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
usb_set_intfdata(intf, NULL);
if (iforce) {
iforce->usbdev = NULL;
input_unregister_device(iforce->dev);
if (!open) {
iforce_delete_device(iforce);
kfree(iforce);
}
}
}Any chance you could fix that FIXME ;) ?
Signature · 1 line
Dmitry
Dmitry Torokhov
maintainerQuoted 45 lines · Dmitry Torokhov
Quoted 17 lines · Johannes Ebke
Hi,
It seems that the force feedback works well, I have ported the force feedback for my favorite game to linux now, and it works well.
What does not work is updating effects - there just nothing happens, and the old event is played. I have circumvented this by deleting/re-uploading the effect, but this should probably been made to work. Does it work well with other hardware?
Thirdly, I have re-discovered one kernel oops that occurs if the joystick is unplugged if some process still has the event device open. Steps to reproduce:
* plug joystick in
* fftest/dev/input/eventXX
* unplug joystickQuoted 5 lines
(kern.log extract attached)
Sometimes this just gives an oops, sometimes it escalates into a kernel panic.
Hmm, it looks like iforce unbinding is completely busted:
static void
iforce_usb_disconnect(struct usb_interface *intf){ struct iforce *iforce = usb_get_intfdata(intf); int open = 0; /* FIXME! iforce->dev.handle->open; */^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
usb_set_intfdata(intf, NULL); if (iforce) { iforce->usbdev = NULL; input_unregister_device(iforce->dev); if (!open) { iforce_delete_device(iforce); kfree(iforce); } } }
Quoted 2 lines
Any chance you could fix that FIXME ;) ?
BTW, could I get you "Signed-off-by: ... " for the Cyborg patch so that I can apply it to my tree?
Thanks.
Signature · 1 line
Dmitry
Dmitry Torokhov
maintainerQuoted 45 lines · Dmitry Torokhov
Quoted 17 lines · Johannes Ebke
Hi,
It seems that the force feedback works well, I have ported the force feedback for my favorite game to linux now, and it works well.
What does not work is updating effects - there just nothing happens, and the old event is played. I have circumvented this by deleting/re-uploading the effect, but this should probably been made to work. Does it work well with other hardware?
Thirdly, I have re-discovered one kernel oops that occurs if the joystick is unplugged if some process still has the event device open. Steps to reproduce:
* plug joystick in
* fftest/dev/input/eventXX
* unplug joystickQuoted 5 lines
(kern.log extract attached)
Sometimes this just gives an oops, sometimes it escalates into a kernel panic.
Hmm, it looks like iforce unbinding is completely busted:
static void
iforce_usb_disconnect(struct usb_interface *intf){ struct iforce *iforce = usb_get_intfdata(intf); int open = 0; /* FIXME! iforce->dev.handle->open; */^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
usb_set_intfdata(intf, NULL); if (iforce) { iforce->usbdev = NULL; input_unregister_device(iforce->dev); if (!open) { iforce_delete_device(iforce); kfree(iforce); } } }
Quoted 2 lines
Any chance you could fix that FIXME ;) ?
Actually, does the below fixes it for you?
Signature · 12 lines
Dmitry Input: iforce - fix oops on device disconnect Reported-by: Johannes Ebke <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]> --- drivers/input/joystick/iforce/iforce-main.c | 26 +++++-------------------- drivers/input/joystick/iforce/iforce-usb.c | 28 +++++++-------------------- drivers/input/joystick/iforce/iforce.h | 2 -- 3 files changed, 12 insertions(+), 44 deletions(-)
drivers/input/joystick/iforce/iforce-main.c +5 -21
@@ -218,7 +218,7 @@ static int iforce_open(struct input_dev *dev)return 0 ; } -static void iforce_release (struct input_dev *dev) +static void iforce_close (struct input_dev *dev) {struct iforce *iforce =input_get_drvdata (dev);int i;
@@ -240,26 +240,10 @@ static void iforce_release(struct input_dev *dev)switch (iforce->bus) {#ifdef CONFIG_JOYSTICK_IFORCE_USB -case IFORCE_USB : -usb_kill_urb (iforce->irq); - -/* The device was unplugged before the file -* was released */ -if (iforce->usbdev ==NULL ) { -iforce_delete_device (iforce); -kfree (iforce); - } -break ; -#endif - } -} - -void iforce_delete_device (struct iforce *iforce) -{ -switch (iforce->bus) { -#ifdef CONFIG_JOYSTICK_IFORCE_USB case IFORCE_USB : -iforce_usb_delete (iforce); +usb_kill_urb (iforce->irq); +usb_kill_urb (iforce->out); +usb_kill_urb (iforce->ctrl);break ;#endif #ifdef CONFIG_JOYSTICK_IFORCE_232
@@ -311,7 +295,7 @@ int iforce_init_device(struct iforce *iforce) input_dev->name ="Unknown I-Force device" ; input_dev->open = iforce_open; - input_dev->close = iforce_release; + input_dev->close = iforce_close;/* * On-device memory allocation.
drivers/input/joystick/iforce/iforce-usb.c +7 -21
@@ -186,33 +186,19 @@ fail:return err; } -/* Called by iforce_delete() */ -void iforce_usb_delete (struct iforce * iforce) -{ -usb_kill_urb (iforce->irq); -usb_kill_urb (iforce->out); -usb_kill_urb (iforce->ctrl); - -usb_free_urb (iforce->irq); -usb_free_urb (iforce->out); -usb_free_urb (iforce->ctrl); -} -static void iforce_usb_disconnect (struct usb_interface *intf) {struct iforce *iforce =usb_get_intfdata (intf); -int open =0 ;/* FIXME! iforce->dev.handle->open; */ usb_set_intfdata (intf,NULL ); -if (iforce) { - iforce->usbdev =NULL ; -input_unregister_device (iforce->dev); -if (!open) { -iforce_delete_device (iforce); -kfree (iforce); - } - } +input_unregister_device (iforce->dev); + +usb_free_urb (iforce->irq); +usb_free_urb (iforce->out); +usb_free_urb (iforce->ctrl); + +kfree (iforce); }static struct usb_device_id iforce_usb_ids [] = {
drivers/input/joystick/iforce/iforce.h +0 -2
@@ -151,11 +151,9 @@ void iforce_serial_xmit(struct iforce *iforce);/* iforce-usb.c */ void iforce_usb_xmit (struct iforce *iforce); -void iforce_usb_delete (struct iforce *iforce);/* iforce-main.c */ int iforce_init_device (struct iforce *iforce); -void iforce_delete_device (struct iforce *iforce);/* iforce-packets.c */ int iforce_control_playback (struct iforce *,u16 id,unsigned int );
Quoted 45 lines · Dmitry Torokhov
Quoted 44 lines · Dmitry Torokhov
Quoted 17 lines · Johannes Ebke
Hi,
It seems that the force feedback works well, I have ported the force feedback for my favorite game to linux now, and it works well.
What does not work is updating effects - there just nothing happens, and the old event is played. I have circumvented this by deleting/re-uploading the effect, but this should probably been made to work. Does it work well with other hardware?
Thirdly, I have re-discovered one kernel oops that occurs if the joystick is unplugged if some process still has the event device open. Steps to reproduce:
* plug joystick in
* fftest/dev/input/eventXX
* unplug joystickQuoted 5 lines
(kern.log extract attached)
Sometimes this just gives an oops, sometimes it escalates into a kernel panic.
Hmm, it looks like iforce unbinding is completely busted:
static void
iforce_usb_disconnect(struct usb_interface *intf){ struct iforce *iforce = usb_get_intfdata(intf); int open = 0; /* FIXME! iforce->dev.handle->open; */^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
usb_set_intfdata(intf, NULL); if (iforce) { iforce->usbdev = NULL; input_unregister_device(iforce->dev); if (!open) { iforce_delete_device(iforce); kfree(iforce); } } }
Quoted 5 lines
Quoted 2 lines
Any chance you could fix that FIXME ;) ?
Actually, does the below fixes it for you?
This fixes the kernel oops - thanks! However it also disables FF, unless I remove "usb_kill_urb(iforce->out);" from iforce_close.
Quoted 1 line
From some debug statements I found that
iforce_closeis called twice if
you just plug in the joystick, so the effect is immediate.
However, when I unplug the joystick while having it open, I get some input input22: usb_submit_urb failed -19
messages in dmesg (after iforce_disconnect but before iforce_close) This is probably what should happen, however.
Cheers,
Johannes
Dmitry Torokhov
maintainerDec 29, 2009, at 4:46 AM, Johannes Ebke <[email protected]
Quoted 51 lines
wrote:
Quoted 48 lines · Dmitry Torokhov
Quoted 46 lines · Dmitry Torokhov
Quoted 17 lines · Johannes Ebke
Hi,
It seems that the force feedback works well, I have ported the force feedback for my favorite game to linux now, and it works well.
What does not work is updating effects - there just nothing happens, and the old event is played. I have circumvented this by deleting/re-uploading the effect, but this should probably been made to work. Does it work well with other hardware?
Thirdly, I have re-discovered one kernel oops that occurs if the joystick is unplugged if some process still has the event device open. Steps to reproduce:
* plug joystick in
* fftest/dev/input/eventXX
* unplug joystickQuoted 5 lines
(kern.log extract attached)
Sometimes this just gives an oops, sometimes it escalates into a kernel panic.
Hmm, it looks like iforce unbinding is completely busted:
static void
iforce_usb_disconnect(struct usb_interface *intf){ struct iforce *iforce = usb_get_intfdata(intf); int open = 0; /* FIXME! iforce->dev.handle->open; */^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
usb_set_intfdata(intf, NULL); if (iforce) { iforce->usbdev = NULL; input_unregister_device(iforce->dev); if (!open) { iforce_delete_device(iforce); kfree(iforce); } } }Any chance you could fix that FIXME ;) ?
Quoted 7 lines
Quoted 2 lines
Actually, does the below fixes it for you?
This fixes the kernel oops - thanks! However it also disables FF, unless I remove "
usb_kill_urb(iforce->out);" fromiforce_close. From some debug statements I found thatiforce_closeis called twice if you just plug in the joystick, so the effect is immediate.
I still believe that usb_kill_urb is needed however we need to wait for packet disabling FF to complete.
Quoted 6 lines
However, when I unplug the joystick while having it open, I get some input input22:
usb_submit_urbfailed -19
messages in dmesg (afteriforce_disconnectbut beforeiforce_close) This is probably what should happen, however.
This is indeed expected with surprise removals.
Signature · 1 line
Dmitry
Dmitry Torokhov
maintainerQuoted 67 lines · Dmitry Torokhov
Dec 29, 2009, at 4:46 AM, Johannes Ebke
Quoted 57 lines · <[email protected]> wrote:
Quoted 50 lines · Dmitry Torokhov
Quoted 49 lines · Dmitry Torokhov
Quoted 21 lines · Johannes Ebke
Hi,
It seems that the force feedback works well, I have ported the force
feedback for my favorite game to linux now, and it works well.What does not work is updating effects - there just nothing happens, and
the old event is played. I have circumvented this by deleting/re-uploading the effect, but this should probably been made to
work. Does it work well with other hardware?Thirdly, I have re-discovered one kernel oops that occurs if the joystick is unplugged if some process still has the event device open.
Steps to reproduce:
* plug joystick in
* fftest/dev/input/eventXX
* unplug joystickQuoted 6 lines
(kern.log extract attached)
Sometimes this just gives an oops, sometimes it escalates into a kernel
panic.Hmm, it looks like iforce unbinding is completely busted:
static void
iforce_usb_disconnect(struct usb_interface *intf){ struct iforce *iforce = usb_get_intfdata(intf); int open = 0; /* FIXME! iforce->dev.handle->open; */^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
usb_set_intfdata(intf, NULL); if (iforce) { iforce->usbdev = NULL; input_unregister_device(iforce->dev); if (!open) { iforce_delete_device(iforce); kfree(iforce); } } }Quoted 5 lines
Quoted 2 lines
Any chance you could fix that FIXME ;) ?
Actually, does the below fixes it for you?
Quoted 6 lines
This fixes the kernel oops - thanks! However it also disables FF, unless
I remove "usb_kill_urb(iforce->out);" fromiforce_close. From some debug statements I found thatiforce_closeis called twice if
you just plug in the joystick, so the effect is immediate.
Quoted 3 lines
I still believe that
usb_kill_urbis needed however we need to wait for packet disabling FF to complete.
Does the patch below (on top of the unmodofied previous one) fixes the issue for you?
Thanks.
Signature · 14 lines
Dmitry Input: iforce - wait for command completion when closing the device We need to wait for the command to disable FF effects to complete before continuing with closing the device. Signed-off-by: Dmitry Torokhov <[email protected]> --- drivers/input/joystick/iforce/iforce-main.c | 3 +++ drivers/input/joystick/iforce/iforce-usb.c | 1 + 2 files changed, 4 insertions(+), 0 deletions(-)
drivers/input/joystick/iforce/iforce-main.c +3 -0
@@ -228,6 +228,9 @@ static void iforce_close(struct input_dev *dev)/* Disable force feedback playback */ iforce_send_packet (iforce,FF_CMD_ENABLE ,"\001" ); +/* Wait for the command to complete */ +wait_event_interruptible (iforce->wait, + !test_bit (IFORCE_XMIT_RUNNING , iforce->xmit_flags)); }switch (iforce->bus) {
drivers/input/joystick/iforce/iforce-usb.c +1 -0
@@ -109,6 +109,7 @@ static void iforce_usb_out(struct urb *urb)struct iforce *iforce = urb->context;if (urb->status) { +clear_bit (IFORCE_XMIT_RUNNING , iforce->xmit_flags);dbg ("urb->status %d, exiting" , urb->status);return ; }
Quoted 65 lines · Dmitry Torokhov
Quoted 64 lines · Dmitry Torokhov
Dec 29, 2009, at 4:46 AM, Johannes Ebke
Quoted 61 lines · <[email protected]> wrote:
Quoted 50 lines · Dmitry Torokhov
Quoted 49 lines · Dmitry Torokhov
Quoted 21 lines · Johannes Ebke
Hi,
It seems that the force feedback works well, I have ported the force
feedback for my favorite game to linux now, and it works well.What does not work is updating effects - there just nothing happens, and
the old event is played. I have circumvented this by deleting/re-uploading the effect, but this should probably been made to
work. Does it work well with other hardware?Thirdly, I have re-discovered one kernel oops that occurs if the joystick is unplugged if some process still has the event device open.
Steps to reproduce:
* plug joystick in
* fftest/dev/input/eventXX
* unplug joystickQuoted 6 lines
(kern.log extract attached)
Sometimes this just gives an oops, sometimes it escalates into a kernel
panic.Hmm, it looks like iforce unbinding is completely busted:
static void
iforce_usb_disconnect(struct usb_interface *intf){ struct iforce *iforce = usb_get_intfdata(intf); int open = 0; /* FIXME! iforce->dev.handle->open; */^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
usb_set_intfdata(intf, NULL); if (iforce) { iforce->usbdev = NULL; input_unregister_device(iforce->dev); if (!open) { iforce_delete_device(iforce); kfree(iforce); } } }Quoted 4 lines
Quoted 2 lines
Any chance you could fix that FIXME ;) ?
Actually, does the below fixes it for you?
This fixes the kernel oops - thanks! However it also disables FF, unless
I remove "usb_kill_urb(iforce->out);" fromiforce_close. From some debug statements I found thatiforce_closeis called twice if
you just plug in the joystick, so the effect is immediate.
Quoted 9 lines
Quoted 3 lines
I still believe that
usb_kill_urbis needed however we need to wait for packet disabling FF to complete.Does the patch below (on top of the unmodofied previous one) fixes the issue for you?
Thanks.
This fixes it completely, both the FF and the clean shutdown on unexpected disconnect! Thank you very much!
Finally, for correct orientation of the rudder axis, I have attached one small change to packets - this makes it work for me if i remove the old configuration.
One other question: Since the USB HID driver can actually discover the joystick buttons and axis ranges sucessfully, would it not be easier to use that for generic input and only add force-feedback in iforce, or is that just too much overhead? Thanks!
Cheers,
Johannes
Input: iforce - flip initial RUDDER orientation to correct one
Remove the inversion from the data acqisition routine
---
input/joystick/iforce/iforce-packets.c renamed from input/joystick/iforce_dmitry/iforce-packets.c +1 -1
@@ -193,7 +193,7 @@if (HI (cmd) ==6 ) {input_report_abs (dev,ABS_THROTTLE , data[4 ]);if (LO (cmd) >=8 &&test_bit (ABS_RUDDER ,dev->absbit)) -input_report_abs (dev,ABS_RUDDER ,255 - data[7 ]); +input_report_abs (dev,ABS_RUDDER , data[7 ]); }else {input_report_abs (dev,ABS_THROTTLE ,255 - data[4 ]);if (LO (cmd) >=8 &&test_bit (ABS_RUDDER ,dev->absbit))
Dmitry Torokhov
maintainerQuoted 70 lines · Johannes Ebke
Quoted 69 lines · Dmitry Torokhov
Quoted 67 lines · Dmitry Torokhov
Dec 29, 2009, at 4:46 AM, Johannes Ebke
Quoted 53 lines · <[email protected]> wrote:
Quoted 52 lines · Dmitry Torokhov
Quoted 51 lines · Dmitry Torokhov
Quoted 21 lines · Johannes Ebke
Hi,
It seems that the force feedback works well, I have ported the force
feedback for my favorite game to linux now, and it works well.What does not work is updating effects - there just nothing happens, and
the old event is played. I have circumvented this by deleting/re-uploading the effect, but this should probably been made to
work. Does it work well with other hardware?Thirdly, I have re-discovered one kernel oops that occurs if the joystick is unplugged if some process still has the event device open.
Steps to reproduce:
* plug joystick in
* fftest/dev/input/eventXX
* unplug joystickQuoted 6 lines
(kern.log extract attached)
Sometimes this just gives an oops, sometimes it escalates into a kernel
panic.Hmm, it looks like iforce unbinding is completely busted:
static void
iforce_usb_disconnect(struct usb_interface *intf){ struct iforce *iforce = usb_get_intfdata(intf); int open = 0; /* FIXME! iforce->dev.handle->open; */^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
usb_set_intfdata(intf, NULL); if (iforce) { iforce->usbdev = NULL; input_unregister_device(iforce->dev); if (!open) { iforce_delete_device(iforce); kfree(iforce); } } }Any chance you could fix that FIXME ;) ?
Quoted 8 lines
Quoted 2 lines
Actually, does the below fixes it for you?
This fixes the kernel oops - thanks! However it also disables FF, unless
I remove "usb_kill_urb(iforce->out);" fromiforce_close. From some debug statements I found thatiforce_closeis called twice if
you just plug in the joystick, so the effect is immediate.I still believe that
usb_kill_urbis needed however we need to wait for packet disabling FF to complete.
Quoted 8 lines
Quoted 5 lines
Does the patch below (on top of the unmodofied previous one) fixes the issue for you?
Thanks.
This fixes it completely, both the FF and the clean shutdown on unexpected disconnect! Thank you very much!
Ah, great!
Quoted 3 lines
Finally, for correct orientation of the rudder axis, I have attached one small change to packets - this makes it work for me if i remove the old configuration.
Hmm, that might break some other users though (or does it only kick in for Cyborg?
Quoted 5 lines
One other question: Since the USB HID driver can actually discover the joystick buttons and axis ranges sucessfully, would it not be easier to use that for generic input and only add force-feedback in iforce, or is that just too much overhead?
We do prefer to have HID driver handle the devices and have only non-HID-compliant devices use specialized drivers. Iforce is an older driver though, working with both USB devices and devices attached to serial ports.
Does your joystick works well with HID driver (sans FF)?
Signature · 1 line
Dmitry
Quoted 78 lines · Dmitry Torokhov
Quoted 69 lines · Johannes Ebke
Quoted 68 lines · Dmitry Torokhov
Quoted 67 lines · Dmitry Torokhov
Dec 29, 2009, at 4:46 AM, Johannes Ebke
Quoted 53 lines · <[email protected]> wrote:
Quoted 52 lines · Dmitry Torokhov
Quoted 51 lines · Dmitry Torokhov
Quoted 21 lines · Johannes Ebke
Hi,
It seems that the force feedback works well, I have ported the force
feedback for my favorite game to linux now, and it works well.What does not work is updating effects - there just nothing happens, and
the old event is played. I have circumvented this by deleting/re-uploading the effect, but this should probably been made to
work. Does it work well with other hardware?Thirdly, I have re-discovered one kernel oops that occurs if the joystick is unplugged if some process still has the event device open.
Steps to reproduce:
* plug joystick in
* fftest/dev/input/eventXX
* unplug joystickQuoted 6 lines
(kern.log extract attached)
Sometimes this just gives an oops, sometimes it escalates into a kernel
panic.Hmm, it looks like iforce unbinding is completely busted:
static void
iforce_usb_disconnect(struct usb_interface *intf){ struct iforce *iforce = usb_get_intfdata(intf); int open = 0; /* FIXME! iforce->dev.handle->open; */^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
usb_set_intfdata(intf, NULL); if (iforce) { iforce->usbdev = NULL; input_unregister_device(iforce->dev); if (!open) { iforce_delete_device(iforce); kfree(iforce); } } }Any chance you could fix that FIXME ;) ?
Quoted 8 lines
Quoted 2 lines
Actually, does the below fixes it for you?
This fixes the kernel oops - thanks! However it also disables FF, unless
I remove "usb_kill_urb(iforce->out);" fromiforce_close. From some debug statements I found thatiforce_closeis called twice if
you just plug in the joystick, so the effect is immediate.I still believe that
usb_kill_urbis needed however we need to wait for packet disabling FF to complete.Quoted 7 lines
Quoted 5 lines
Does the patch below (on top of the unmodofied previous one) fixes the issue for you?
Thanks.
This fixes it completely, both the FF and the clean shutdown on unexpected disconnect! Thank you very much!
Quoted 8 lines
Ah, great!
Quoted 3 lines
Finally, for correct orientation of the rudder axis, I have attached one small change to packets - this makes it work for me if i remove the old configuration.
Hmm, that might break some other users though (or does it only kick in for Cyborg?
This is in the part that only kicks in for the Cyborg, or perhaps other devices as well (if(HI(cmd)==6)..)
Quoted 6 lines
Quoted 5 lines
One other question: Since the USB HID driver can actually discover the joystick buttons and axis ranges sucessfully, would it not be easier to use that for generic input and only add force-feedback in iforce, or is that just too much overhead?
Quoted 7 lines
We do prefer to have HID driver handle the devices and have only non-HID-compliant devices use specialized drivers. Iforce is an older driver though, working with both USB devices and devices attached to serial ports.
Does your joystick works well with HID driver (sans FF)?
Yes, with one grievance: Since the "dead man switch" is not physically present on the cyborg but logically present and "always on", some applications like the flightgear joystick calibration "fgjs" cannot be used. However, I am not sure how the information "this is a dead man switch" can be published to userspace most efficiently, and the application should probably deal with it anyway (stuck key in old joystick, etc...)
Cheers,
Johannes
Is there any progress on this driver? Johannes seems to of gotten it working from what I have read.
I own a Cyborg Evo Force but I would like the force feedback driver to be committed to the mainline so that it can be released with future Linux distributions.
As of today, I cant see any mention of the Saitek Cyborg Evo Force in the IForce driver in Linux 3.0 rc2's source. What seems to be the roadblock to committing it to mainline?
Quoted 119 lines · Johannes Ebke
Quoted 78 lines · Dmitry Torokhov
Quoted 69 lines · Johannes Ebke
Quoted 68 lines · Dmitry Torokhov
Quoted 67 lines · Dmitry Torokhov
Dec 29, 2009, at 4:46 AM, Johannes Ebke
Quoted 53 lines · <[email protected]> wrote:
Quoted 52 lines · Dmitry Torokhov
Quoted 51 lines · Dmitry Torokhov
Quoted 21 lines · Johannes Ebke
Hi,
It seems that the force feedback works well, I have ported the force
feedback for my favorite game to linux now, and it works well.What does not work is updating effects - there just nothing happens, and
the old event is played. I have circumvented this by deleting/re-uploading the effect, but this should probably been made to
work. Does it work well with other hardware?Thirdly, I have re-discovered one kernel oops that occurs if the joystick is unplugged if some process still has the event device open.
Steps to reproduce:
* plug joystick in
* fftest/dev/input/eventXX
* unplug joystickQuoted 6 lines
(kern.log extract attached)
Sometimes this just gives an oops, sometimes it escalates into a kernel
panic.Hmm, it looks like iforce unbinding is completely busted:
static void
iforce_usb_disconnect(struct usb_interface *intf){
struct iforce *iforce =usb_get_intfdata(intf); int open = 0; /* FIXME!iforce->dev.handle->open; */ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
usb_set_intfdata(intf, NULL);
if (iforce) {
iforce->usbdev= NULL;input_unregister_device(iforce->dev);if (!open) {
iforce_delete_device(iforce); kfree(iforce);
}
}
}Any chance you could fix that FIXME ;) ?
Quoted 8 lines
Quoted 2 lines
Actually, does the below fixes it for you?
This fixes the kernel oops - thanks! However it also disables FF, unless
I remove "usb_kill_urb(iforce->out);" fromiforce_close. From some debug statements I found thatiforce_closeis called twice if
you just plug in the joystick, so the effect is immediate.I still believe that
usb_kill_urbis needed however we need to wait for packet disabling FF to complete.Quoted 7 lines
Quoted 5 lines
Does the patch below (on top of the unmodofied previous one) fixes the issue for you?
Thanks.
This fixes it completely, both the FF and the clean shutdown on unexpected disconnect! Thank you very much!
Quoted 8 lines
Ah, great!
Quoted 3 lines
Finally, for correct orientation of the rudder axis, I have attached one small change to packets - this makes it work for me if i remove the old configuration.
Hmm, that might break some other users though (or does it only kick in for Cyborg?
This is in the part that only kicks in for the Cyborg, or perhaps other devices as well (if(HI(cmd)==6)..)
Quoted 6 lines
Quoted 5 lines
One other question: Since the USB HID driver can actually discover the joystick buttons and axis ranges sucessfully, would it not be easier to use that for generic input and only add force-feedback in iforce, or is that just too much overhead?
Quoted 7 lines
We do prefer to have HID driver handle the devices and have only non-HID-compliant devices use specialized drivers. Iforce is an older driver though, working with both USB devices and devices attached to serial ports.
Does your joystick works well with HID driver (sans FF)?
Yes, with one grievance: Since the "dead man switch" is not physically present on the cyborg but logically present and "always on", some applications like the flightgear joystick calibration "fgjs" cannot be used. However, I am not sure how the information "this is a dead man switch" can be published to userspace most efficiently, and the application should probably deal with it anyway (stuck key in old joystick, etc...)
Cheers,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 5 lines
Thanks, Richie Ward -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/1 Linux Force Feedback for Saitek Cyborg Evo Force
In reply to Dmitry TorokhovHi,
I am doing this for the first time - I hope I got it correctly.
Cheers,
Johannes
This patch adds support for the Saitek Cyborg Evo Force Joystick to the iforce driver
From: Johannes Ebke <[email protected]>
input/joystick/iforce/iforce.h renamed from input/joystick/iforce_orig/iforce.h +1 -0
@@ -96,6 +96,7 @@signed short *btn;signed short *abs;signed short *ff; +bool has_btndead; };struct iforce {
input/joystick/iforce/iforce-main.c renamed from input/joystick/iforce_orig/iforce-main.c +31 -16
83 lines not on this page · raw message
input/joystick/iforce/iforce-packets.c renamed from input/joystick/iforce_orig/iforce-packets.c +19 -9
@@ -182,16 +182,24 @@case 0x01 :/* joystick position data */ case 0x03 :/* wheel position data */ -if (HI (cmd) ==1 ) { -input_report_abs (dev,ABS_X , (__s16) (((__s16 )data[1 ] <<8 ) | data[0 ])); -input_report_abs (dev,ABS_Y , (__s16) (((__s16 )data[3 ] <<8 ) | data[2 ])); -input_report_abs (dev,ABS_THROTTLE ,255 - data[4 ]); -if (LO (cmd) >=8 &&test_bit (ABS_RUDDER ,dev->absbit)) -input_report_abs (dev,ABS_RUDDER , (__s8 )data[7 ]); - }else { +case 0x06 :/* saitek position data */ +if (HI (cmd) ==3 ) {input_report_abs (dev,ABS_WHEEL , (__s16) (((__s16 )data[1 ] <<8 ) | data[0 ]));input_report_abs (dev,ABS_GAS ,255 - data[2 ]);input_report_abs (dev,ABS_BRAKE ,255 - data[3 ]); + }else { +input_report_abs (dev,ABS_X , (__s16) (((__s16 )data[1 ] <<8 ) | data[0 ])); +input_report_abs (dev,ABS_Y , (__s16) (((__s16 )data[3 ] <<8 ) | data[2 ])); +if (HI (cmd) ==6 ) { +input_report_abs (dev,ABS_THROTTLE , data[4 ]); +if (LO (cmd) >=8 &&test_bit (ABS_RUDDER ,dev->absbit)) +input_report_abs (dev,ABS_RUDDER ,255 - data[7 ]); + }else { +input_report_abs (dev,ABS_THROTTLE ,255 - data[4 ]); +if (LO (cmd) >=8 &&test_bit (ABS_RUDDER ,dev->absbit)) +input_report_abs (dev,ABS_RUDDER , (__s8 )data[7 ]); + } + }input_report_abs (dev,ABS_HAT0X , iforce_hat_to_axis[data[6 ] >>4 ].x);
@@ -220,8 +228,10 @@break ;case 0x02 :/* status report */ -input_report_key (dev,BTN_DEAD , data[0 ] &0x02 ); -input_sync (dev); +if (iforce->type->has_btndead) { +input_report_key (dev,BTN_DEAD , data[0 ] &0x02 ); +input_sync (dev); + }/* Check if an effect was just started or stopped */ i = data[1 ] &0x7f ;
input/joystick/iforce/iforce-usb.c renamed from input/joystick/iforce_orig/iforce-usb.c +1 -0
@@ -227,6 +227,7 @@ { USB_DEVICE(0x06f8, 0x0001) }, /* Guillemot Race Leader Force Feedback */ { USB_DEVICE(0x06f8, 0x0004) }, /* Guillemot Force Feedback Racing Wheel */ { USB_DEVICE(0x06f8, 0xa302) }, /* Guillemot Jet Leader 3D */ + { USB_DEVICE(0x06a3, 0xffb5) }, /* Saitek Cyborg Evo Force */ { } /* Terminating entry */ };