|
From: <py...@lo...> - 2005-04-24 10:35:36
|
Hi, > >>3. Identify packets describing the state of the stick. Those are not the > >>packets you are interested in. > > > > Well it's lots of data, trying to find a method for not (at least not > > fully) manual searchigh through URB-s, however joystick after startup > > emulates spring, dou You remember (or have it written) if there are any > > force - related information sent for this reason ? > > Yes, I think so. I expect it might send one single spring condition > effect to emulate auto-center. > > Look for URBs similar to those sent by lgff for constant and rumble > effects, they are similar (same endpoints, same size, only the opcode > and the parameters change). > Well, I had some time to do the sniffing/log analysing this weekend, here are some (preliminary) results... Bulk transfer to set force looks more or less like this: 0x 6b 6e 81 78 00 55 28 where: first two bytes I guess could be force value - URB-s are sent pretty often for example for "ramp" with these bytes changed third byte might mean constatn force (or something else, however it never seems to change, or I have not done enough sniffing with different parameters so far ;) ) 4th - 6th byte - well no idea for now, they do change but not too often - maybe gain or something ? 7th byte - force direction (axis) ? > >>4. look at the data when effects are played > > > > I thought there was some effect tester/modeller with directX (direct > > input). I guess I was wrong (at least about directx9c), do You know > > anything (but plain C programs I could write) that allows playing custom > > effects ? > > You can get a trial version of immersion studio there: > http://www.immersion.com/developer/downloads/IStudio/IStudio.msi > (I can't believe they made it paying, the full version used to be > available for free...) > > There should also be an effect designer with the directx sdk (not the > runtime), I'm not sure if I dreamed it or if I actually used it :) Thanks, I have it now. At first I downloaded too new version of dx_sdk - april2005 does not have Force Editor bundled - summer2004 does ;) > >>5. Identify the packets that were not there in 2 and 1. Those are > >>probably force-feedback packets > >>6. Change the parameters of the effects, look at the data, guess what > >>bytes encode what parameters > > > > Well, I'll try;). > > > >>I've already done 1 to 5, I was trying to do 6 for spring/friction > >>effects when my stick stopped working. > >>The packets for condition effects use the same pipe as packets for > >>constant force, they have a similar structure as well. > >> > >>You might want to install cygwin so that you get access to grep, sort... > >>they are usefull to sort and filter large anounts of data automatically. > > > > 1. Well, I've done some sniffing fo far but results are not yet very > > clear, I'll have to find some reasonable method not using logitech - > > provided tester (since it does not generate custom effects - i guess - > > just shots, crashes and so on). > > Is there a ready-made tool to send custom packets/sequences of packets to > > the device, or I will have to write my own one ? (preferably linux one - > > not to interfere with windows drivers which seem to go crazy with just > > the sniffer). > > Don't know, you should check the usb-devel mailing lists (the archive, > that's probably a common request). I found usb-robot which should send custom packets to the device (it is based on libusb), however when I'm "trying to talk to device 003 on bus 004 (idVendor 0x46d idProduct 0xc283), usb-robot-slave on my attempt: transfer type=bulk ep=0x1 size=7 dir=out 66 78 81 7b 00 5F 03 says: doing bulk transfer id 2 to ep 0x1, size 7, timeout 10000 frames status: problem doing write usb error: error submitting URB: Device or resource busy Is the driver locking access to the device (is there a way to prevent it ?) or there could be another problem ? I guess parameters I wrote should be fine, since lsusb -v says: Bus 004 Device 002: ID 046d:c283 Logitech, Inc. WingMan Force 3D Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x046d Logitech, Inc. idProduct 0xc283 WingMan Force 3D bcdDevice 1.06 iManufacturer 4 Logitech Inc. iProduct 32 WingMan Force 3D iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 41 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 MaxPower 80mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Devices bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.00 bCountryCode 33 bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 130 cannot get report descriptor Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type none wMaxPacketSize 8 bInterval 10 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 3 Transfer Type Interrupt Synch Type none wMaxPacketSize 8 bInterval 10 Language IDs: (length=4) 0409 English(US) > > Correct me if I'm wrong, I started looking through the linux driver, to > > find (at least more or less what to look for). In the kernel (source), in > > hid-lgff.c what stores effects is called "private". It's declared as a > > void pointer in input.h and it is allocated as lgff_devices structure in > > hid-lgff.c. When/(or maybe if) I find something useful I should fill this > > structure's fields with propper data (like it is done int > > privete->constant->field[0]...). > > Yes. > > > lgff_device has (among other) elements: constant and rumble, but what > > about ramp, sine and so on? are they "struct lgff_effect effects[8]" ? > > (or at the moment there is just no room for them ? Well, I'm just > > starting to look through the source code to find out what and how is > > done, so my questions might be quite silly for now ;) ) > > Note that this device does not support non-constant effects natively > (does not seem so at least). They are emulated by the driver by updating > constant effects at regular intervals. > I don't have my code at hand right now, but I guess you may want to add > fields for parameters of periodic effects (sine, ramp...) Well, now I see it ;) In this case I think maybe it would be more convenient to keep kernel side driver as-is (or with as few changes as possible, to keep it small) and implement more complex effects in a library... Michal |