Skip to contentSkip to conversation

Logitech Spring FF

DISCUSSION Applied johann deneux 5 participants 9 messages Apr 7, 2007 – May 12, 2007 3 messages not in the archive HID

lore
Share & tools
lore
#3 lore raw
In reply to a message not in the archive

I'm forwarding this mail to linux-input, that's a better place for this discussion.
Richard is working on adding support for spring force feedback effects to the hid-lgff driver.

Quoted 7 lines · Richard Bolkey
Quoted 4 lines · johann deneux

Yes. It's possible to implement everything using a constant force effect updated at regular intervals.
Are you working to extending the driver in the kernel, or are you doing the work in user-space?

Working off the driver in the kernel. Can/should I do this in user space? I also noticed with the latest kernels there is a ff-memless.c.

I'm not sure. Doing in the kernel would allow for a shorter update cycle, I think. I had initially intended to do what you are doing in the kernel, but I never actually finished the task.
One of the problem I remember encountering was related to computing sine values when simulating a periodic effect. Is there a math lib available in the kernel?

Quoted 2 lines

Is that an attempt to do all effect calculations in a single module, and a driver like hid-lgff.c would just need to do the device recognitions?

I guess so, but you should check with the author.

#4 lore raw
Quoted 11 lines · johann deneux

I'm forwarding this mail to linux-input, that's a better place for this discussion.
Richard is working on adding support for spring force feedback effects to the hid-lgff driver.

Quoted 5 lines · Richard Bolkey
Quoted 4 lines · johann deneux

Yes. It's possible to implement everything using a constant force effect updated at regular intervals.
Are you working to extending the driver in the kernel, or are you doing the work in user-space?

Quoted 6 lines
Quoted 2 lines

Working off the driver in the kernel. Can/should I do this in user space? I also noticed with the latest kernels there is a ff-memless.c.

I'm not sure. Doing in the kernel would allow for a shorter update cycle, I think. I had initially intended to do what you are doing in the kernel, but I never actually finished the task.

The correct way to implement this is to do it in ff-memless.c, and it already has the framework to do effect conversions.

Quoted 3 lines

One of the problem I remember encountering was related to computing sine values when simulating a periodic effect. Is there a math lib available in the kernel?

There is your fixp-arith.h in /drivers/input and apparently some random math functions in /lib.

(and I think the fixp-arith.h should really be in /lib as well)

Quoted 5 lines
Quoted 2 lines

Is that an attempt to do all effect calculations in a single module, and a driver like hid-lgff.c would just need to do the device recognitions?

I guess so, but you should check with the author.

Yes, it is.

Signature · 1 line
Anssi Hannula
#5 lore raw

First off, I've never made a patch before, which I guess I better learn, but for now if anyone wants to add the device_type for the Logitech Force 3D Pro Joystick to hid-lgff.c, it's { 0x046d, 0xc286, ff_joystick }.

Now for a few follow up questions (this is a whole lot of new stuff, so bear with me).

1) I'm gathering that Logitech keeps their hid reports secret and non-standard, or else I'd just be using the HID PID driver? So, were the values in the reports found in hid_lgff_play discovered through trial and error? How would I find what the report for FF_SPRING should look like?

2) Previous question assumes that is where I should implement the effect since ml->play_effect is referencing that function in ff_memless.c. But it sounded like Anssi was recommending doing a spring->constant conversion akin to what looks like a periodic->rumble conversion in ml_combine_effects?

Thanks,
Rick

#6 lore raw
Quoted 4 lines · Richard Bolkey

First off, I've never made a patch before, which I guess I better learn, but for now if anyone wants to add the device_type for the Logitech Force 3D Pro Joystick to hid-lgff.c, it's { 0x046d, 0xc286, ff_joystick }.

That would be Jiri Kosina (CCed).

Quoted 18 lines

Now for a few follow up questions (this is a whole lot of new stuff, so bear with me).

1) I'm gathering that Logitech keeps their hid reports secret and non-standard, or else I'd just be using the HID PID driver? So, were the values in the reports found in hid_lgff_play discovered through trial and error? How would I find what the report for FF_SPRING should look like?

2) Previous question assumes that is where I should implement the effect since ml->play_effect is referencing that function in ff_memless.c. But it sounded like Anssi was recommending doing a spring->constant conversion akin to what looks like a periodic->rumble conversion in ml_combine_effects?

Thanks,
Rick

Signature · 1 line
Dmitry
#7 lore raw
In reply to Richard Bolkey
Quoted 4 lines · Richard Bolkey

First off, I've never made a patch before, which I guess I better learn, but for now if anyone wants to add the device_type for the Logitech Force 3D Pro Joystick to hid-lgff.c, it's { 0x046d, 0xc286, ff_joystick }.

Quoted 8 lines

Now for a few follow up questions (this is a whole lot of new stuff, so bear with me).

1) I'm gathering that Logitech keeps their hid reports secret and non-standard, or else I'd just be using the HID PID driver? So, were the values in the reports found in hid_lgff_play discovered through trial and error? How would I find what the report for FF_SPRING should look like?

You can do that by spying on the USB traffic generated by an existing driver. That's what I did. I thought I had managed to identify the report used for springs, but at that point my device died and that's where I stopped.

Quoted 6 lines

2) Previous question assumes that is where I should implement the effect since ml->play_effect is referencing that function in ff_memless.c. But it sounded like Anssi was recommending doing a spring->constant conversion akin to what looks like a periodic->rumble conversion in ml_combine_effects?

That's another way of doing it.

Quoted 4 lines

Thanks,
Rick

Applied
#11 lore raw
In reply to Richard Bolkey
Quoted 3 lines · Richard Bolkey

First off, I've never made a patch before, which I guess I better learn, but for now if anyone wants to add the device_type for the Logitech Force 3D Pro Joystick to hid-lgff.c, it's { 0x046d, 0xc286, ff_joystick }.

Queued support for 0x046d/0xc286 in my tree for upstream. Thanks.

Quoted 5 lines

1) I'm gathering that Logitech keeps their hid reports secret and non-standard, or else I'd just be using the HID PID driver? So, were the values in the reports found in hid_lgff_play discovered through trial and error? How would I find what the report for FF_SPRING should look like?

You can monitor how other already existing drivers behave, and try to simulate the behavior in your driver.

Signature · 1 line
Jiri Kosina
#8 lore raw

Re: Logitech Spring FF (effect on/off)

In reply to johann deneux

Alright, I can turn the spring effect on; however, I can't turn it off right now. There is a separate report that needs to be sent to turn off the spring effect for each axis. I can't see an obvious place to put that kind of functionality into the framework of ff-memless. I'm wondering if this means my device isn't "memoryless"? Any advice?

#9 lore raw

Re: Logitech Spring FF (effect on/off)

Richard Bolkey kirjoitti:

Quoted 1 line

Alright, I can turn the spring effect on; however, I can't turn it off right now. There is a separate report that needs to be sent to turn off the spring effect for each axis. I can't see an obvious place to put that kind of functionality into the framework of ff-memless. I'm wondering if this means my device isn't "memoryless"? Any advice?

For the FF_RUMBLE and FF_CONSTANT effects, if I remember correctly, ff-memless sends a zero-magnitude effect to the device driver when the effect is supposed to be turned off. You can do it similarly for the spring effect.

Signature · 1 line
Anssi Hannula
#10 lore raw

Re: Logitech Spring FF (effect on/off)

In reply to Richard Bolkey

On the subject of the protocole used by Logitech devices for force-feedback, here is some information that could be interesting:

http://vdrift.net/Forum/viewtopic.php?t=412&postdays=0&postorder=asc&start=60

The user named "anrp" has found information that I suspect is not limited to the G25.

Quoted 6 lines · Richard Bolkey

Alright, I can turn the spring effect on; however, I can't turn it off right now. There is a separate report that needs to be sent to turn off the spring effect for each axis. I can't see an obvious place to put that kind of functionality into the framework of ff-memless. I'm wondering if this means my device isn't "memoryless"? Any advice?