Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) ===============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) Iforce Protocol
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) ===============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) :Author: Johann Deneux <johann.deneux@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) Home page at `<http://web.archive.org/web/*/http://www.esil.univ-mrs.fr>`_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) :Additions: by Vojtech Pavlik.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) Introduction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) ============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) This document describes what I managed to discover about the protocol used to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) specify force effects to I-Force 2.0 devices.  None of this information comes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) from Immerse. That's why you should not trust what is written in this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) document. This document is intended to help understanding the protocol.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) This is not a reference. Comments and corrections are welcome.  To contact me,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) send an email to: johann.deneux@gmail.com
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) .. warning::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)     I shall not be held responsible for any damage or harm caused if you try to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)     send data to your I-Force device based on what you read in this document.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) Preliminary Notes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) =================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) All values are hexadecimal with big-endian encoding (msb on the left). Beware,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) values inside packets are encoded using little-endian.  Bytes whose roles are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) unknown are marked ???  Information that needs deeper inspection is marked (?)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) General form of a packet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) ------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) This is how packets look when the device uses the rs232 to communicate.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) == == === ==== ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 2B OP LEN DATA CS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) == == === ==== ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) CS is the checksum. It is equal to the exclusive or of all bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) When using USB:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) == ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) OP DATA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) == ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) The 2B, LEN and CS fields have disappeared, probably because USB handles
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) frames and data corruption is handled or unsignificant.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) First, I describe effects that are sent by the device to the computer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) Device input state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) ==================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) This packet is used to indicate the state of each button and the value of each
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) axis::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)     OP= 01 for a joystick, 03 for a wheel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)     LEN= Varies from device to device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)     00 X-Axis lsb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)     01 X-Axis msb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)     02 Y-Axis lsb, or gas pedal for a wheel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)     03 Y-Axis msb, or brake pedal for a wheel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)     04 Throttle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)     05 Buttons
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)     06 Lower 4 bits: Buttons
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)        Upper 4 bits: Hat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)     07 Rudder
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) Device effects states
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) =====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)     OP= 02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)     LEN= Varies
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)     00 ? Bit 1 (Value 2) is the value of the deadman switch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)     01 Bit 8 is set if the effect is playing. Bits 0 to 7 are the effect id.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)     02 ??
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)     03 Address of parameter block changed (lsb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)     04 Address of parameter block changed (msb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)     05 Address of second parameter block changed (lsb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)     ... depending on the number of parameter blocks updated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) Force effect
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) ------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)     OP=  01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)     LEN= 0e
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)     00 Channel (when playing several effects at the same time, each must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)                 be assigned a channel)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)     01 Wave form
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	    Val 00 Constant
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	    Val 20 Square
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	    Val 21 Triangle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	    Val 22 Sine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	    Val 23 Sawtooth up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	    Val 24 Sawtooth down
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	    Val 40 Spring (Force = f(pos))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	    Val 41 Friction (Force = f(velocity)) and Inertia
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	           (Force = f(acceleration))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)     02 Axes affected and trigger
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	    Bits 4-7: Val 2 = effect along one axis. Byte 05 indicates direction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		    Val 4 = X axis only. Byte 05 must contain 5a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		    Val 8 = Y axis only. Byte 05 must contain b4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		    Val c = X and Y axes. Bytes 05 must contain 60
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	    Bits 0-3: Val 0 = No trigger
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 		    Val x+1 = Button x triggers the effect
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	    When the whole byte is 0, cancel the previously set trigger
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)     03-04 Duration of effect (little endian encoding, in ms)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)     05 Direction of effect, if applicable. Else, see 02 for value to assign.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)     06-07 Minimum time between triggering.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)     08-09 Address of periodicity or magnitude parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)     0a-0b Address of attack and fade parameters, or ffff if none.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)     *or*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)     08-09 Address of interactive parameters for X-axis,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)           or ffff if not applicable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)     0a-0b Address of interactive parameters for Y-axis,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	  or ffff if not applicable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)     0c-0d Delay before execution of effect (little endian encoding, in ms)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) Time based parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) ---------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) Attack and fade
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) ^^^^^^^^^^^^^^^
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)     OP=  02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)     LEN= 08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)     00-01 Address where to store the parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)     02-03 Duration of attack (little endian encoding, in ms)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)     04 Level at end of attack. Signed byte.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)     05-06 Duration of fade.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)     07 Level at end of fade.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) Magnitude
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) ^^^^^^^^^
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)     OP=  03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)     LEN= 03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)     00-01 Address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)     02 Level. Signed byte.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) Periodicity
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) ^^^^^^^^^^^
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)     OP=  04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)     LEN= 07
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)     00-01 Address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)     02 Magnitude. Signed byte.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)     03 Offset. Signed byte.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)     04 Phase. Val 00 = 0 deg, Val 40 = 90 degs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)     05-06 Period (little endian encoding, in ms)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) Interactive parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) ----------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)     OP=  05
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)     LEN= 0a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)     00-01 Address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)     02 Positive Coeff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)     03 Negative Coeff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)     04+05 Offset (center)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)     06+07 Dead band (Val 01F4 = 5000 (decimal))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)     08 Positive saturation (Val 0a = 1000 (decimal) Val 64 = 10000 (decimal))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)     09 Negative saturation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) The encoding is a bit funny here: For coeffs, these are signed values. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) maximum value is 64 (100 decimal), the min is 9c.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) For the offset, the minimum value is FE0C, the maximum value is 01F4.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) For the deadband, the minimum value is 0, the max is 03E8.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) Controls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) --------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)     OP=  41
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)     LEN= 03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)     00 Channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)     01 Start/Stop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	    Val 00: Stop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	    Val 01: Start and play once.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	    Val 41: Start and play n times (See byte 02 below)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)     02 Number of iterations n.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) Init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) ----
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) Querying features
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) ^^^^^^^^^^^^^^^^^
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)     OP=  ff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)     Query command. Length varies according to the query type.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)     The general format of this packet is:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)     ff 01 QUERY [INDEX] CHECKSUM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)     responses are of the same form:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)     FF LEN QUERY VALUE_QUERIED CHECKSUM2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)     where LEN = 1 + length(VALUE_QUERIED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) Query ram size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) ~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)     QUERY = 42 ('B'uffer size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) The device should reply with the same packet plus two additional bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) containing the size of the memory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) ff 03 42 03 e8 CS would mean that the device has 1000 bytes of ram available.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) Query number of effects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) ~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)     QUERY = 4e ('N'umber of effects)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) The device should respond by sending the number of effects that can be played
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) at the same time (one byte)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) ff 02 4e 14 CS would stand for 20 effects.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) Vendor's id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) ~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)     QUERY = 4d ('M'anufacturer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) Query the vendors'id (2 bytes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) Product id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) ~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)     QUERY = 50 ('P'roduct)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) Query the product id (2 bytes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) Open device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) ~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)     QUERY = 4f ('O'pen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) No data returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) Close device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) ~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)     QUERY = 43 ('C')lose
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) No data returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) Query effect
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) ~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)     QUERY = 45 ('E')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) Send effect type.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) Returns nonzero if supported (2 bytes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) Firmware Version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) ~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)     QUERY = 56 ('V'ersion)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) Sends back 3 bytes - major, minor, subminor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) Initialisation of the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) Set Control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) ~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)     Device dependent, can be different on different models!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)     OP=  40 <idx> <val> [<val>]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)     LEN= 2 or 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315)     00 Idx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)        Idx 00 Set dead zone (0..2048)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)        Idx 01 Ignore Deadman sensor (0..1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)        Idx 02 Enable comm watchdog (0..1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)        Idx 03 Set the strength of the spring (0..100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)        Idx 04 Enable or disable the spring (0/1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)        Idx 05 Set axis saturation threshold (0..2048)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) Set Effect State
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) ~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)     OP=  42 <val>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)     LEN= 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)     00 State
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)        Bit 3 Pause force feedback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332)        Bit 2 Enable force feedback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)        Bit 0 Stop all effects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) Set overall
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) ~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)     OP=  43 <val>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)     LEN= 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)     00 Gain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)        Val 00 = 0%
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)        Val 40 = 50%
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)        Val 80 = 100%
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) Parameter memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) ----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) Each device has a certain amount of memory to store parameters of effects.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) The amount of RAM may vary, I encountered values from 200 to 1000 bytes. Below
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) is the amount of memory apparently needed for every set of parameters:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)  - period : 0c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)  - magnitude : 02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)  - attack and fade : 0e
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)  - interactive : 08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) Appendix: How to study the protocol?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) ====================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 1. Generate effects using the force editor provided with the DirectX SDK, or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) use Immersion Studio (freely available at their web site in the developer section:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) www.immersion.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 2. Start a soft spying RS232 or USB (depending on where you connected your
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) joystick/wheel). I used ComPortSpy from fCoder (alpha version!)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 3. Play the effect, and watch what happens on the spy screen.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) A few words about ComPortSpy:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) At first glance, this software seems, hum, well... buggy. In fact, data appear with a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) few seconds latency. Personally, I restart it every time I play an effect.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) Remember it's free (as in free beer) and alpha!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) URLS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) Check http://www.immerse.com for Immersion Studio,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) and http://www.fcoder.com for ComPortSpy.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) I-Force is trademark of Immersion Corp.