|
@@ -5,7 +5,7 @@ import "unsafe"
|
|
|
|
|
|
|
|
|
|
|
|
-type input_event struct {
|
|
|
+type INPUT_event struct {
|
|
|
time timeval
|
|
|
type_ uint16
|
|
|
code uint16
|
|
@@ -22,7 +22,7 @@ const EV_VERSION=0x010001
|
|
|
* IOCTLs (0x00 - 0x7f)
|
|
|
*/
|
|
|
|
|
|
-type input_id struct {
|
|
|
+type INPUT_id struct {
|
|
|
bustype uint16
|
|
|
vendor uint16
|
|
|
product uint16
|
|
@@ -30,7 +30,7 @@ type input_id struct {
|
|
|
}
|
|
|
|
|
|
|
|
|
- * struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls
|
|
|
+ * struct INPUT_absinfo - used by EVIOCGABS/EVIOCSABS ioctls
|
|
|
* @value: latest reported value for the axis.
|
|
|
* @minimum: specifies minimum value for the axis.
|
|
|
* @maximum: specifies maximum value for the axis.
|
|
@@ -48,7 +48,7 @@ type input_id struct {
|
|
|
* units per millimeter (units/mm), resolution for rotational axes
|
|
|
* (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian.
|
|
|
*/
|
|
|
-type input_absinfo struct {
|
|
|
+type INPUT_absinfo struct {
|
|
|
value int32;
|
|
|
minimum int32;
|
|
|
maximum int32;
|
|
@@ -61,7 +61,7 @@ const INPUT_KEYMAP_BYINDEX = (1 << 0)
|
|
|
|
|
|
|
|
|
|
|
|
- * struct input_keymap_entry - used by EVIOCGKEYCODE/EVIOCSKEYCODE ioctls
|
|
|
+ * struct INPUT_keymap_entry - used by EVIOCGKEYCODE/EVIOCSKEYCODE ioctls
|
|
|
* @scancode: scancode represented in machine-endian form.
|
|
|
* @len: length of the scancode that resides in @scancode buffer.
|
|
|
* @index: index in the keymap, may be used instead of scancode
|
|
@@ -75,7 +75,7 @@ const INPUT_KEYMAP_BYINDEX = (1 << 0)
|
|
|
* in keymap entry. EVIOCGKEYCODE will also return scancode or index
|
|
|
* (depending on which element was used to perform lookup).
|
|
|
*/
|
|
|
-type input_keymap_entry struct {
|
|
|
+type INPUT_keymap_entry struct {
|
|
|
flags uint8;
|
|
|
len uint8;
|
|
|
index uint16;
|
|
@@ -83,7 +83,7 @@ type input_keymap_entry struct {
|
|
|
scancode [32]uint8;
|
|
|
};
|
|
|
|
|
|
-type input_mask struct {
|
|
|
+type INPUT_mask struct {
|
|
|
type_ uint32;
|
|
|
codes_size uint32;
|
|
|
codes_ptr uint32;
|
|
@@ -94,23 +94,23 @@ type uint32p = [2]uint32
|
|
|
const sizeof_uint32p = unsafe.Sizeof(*((*uint32p)(nil)))
|
|
|
const sizeof_int32 = unsafe.Sizeof(*((*int32)(nil)))
|
|
|
const sizeof_uint32 = unsafe.Sizeof(*((*uint32)(nil)))
|
|
|
-const sizeof_input_id = unsafe.Sizeof(*((*input_id)(nil)))
|
|
|
-const sizeof_input_keymap_entry = unsafe.Sizeof(*((*input_keymap_entry)(nil)))
|
|
|
-const sizeof_input_absinfo = unsafe.Sizeof(*((*input_absinfo)(nil)))
|
|
|
-const sizeof_input_mask = unsafe.Sizeof(*((*input_mask)(nil)))
|
|
|
-const sizeof_ff_effect = unsafe.Sizeof(*((*ff_effect)(nil)))
|
|
|
+const sizeof_INPUT_id = unsafe.Sizeof(*((*INPUT_id)(nil)))
|
|
|
+const sizeof_INPUT_keymap_entry = unsafe.Sizeof(*((*INPUT_keymap_entry)(nil)))
|
|
|
+const sizeof_INPUT_absinfo = unsafe.Sizeof(*((*INPUT_absinfo)(nil)))
|
|
|
+const sizeof_INPUT_mask = unsafe.Sizeof(*((*INPUT_mask)(nil)))
|
|
|
+const sizeof_FF_effect = unsafe.Sizeof(*((*FF_effect)(nil)))
|
|
|
|
|
|
|
|
|
|
|
|
var EVIOCGVERSION = IOR('E', 0x01, sizeof_int32)
|
|
|
-var EVIOCGID = IOR('E', 0x02, sizeof_input_id)
|
|
|
+var EVIOCGID = IOR('E', 0x02, sizeof_INPUT_id)
|
|
|
var EVIOCGREP = IOR('E', 0x03, sizeof_uint32p)
|
|
|
var EVIOCSREP = IOW('E', 0x03, sizeof_uint32p)
|
|
|
|
|
|
var EVIOCGKEYCODE = IOR('E', 0x04, sizeof_uint32)
|
|
|
-var EVIOCGKEYCODE_V2= IOR('E', 0x04, sizeof_input_keymap_entry)
|
|
|
+var EVIOCGKEYCODE_V2= IOR('E', 0x04, sizeof_INPUT_keymap_entry)
|
|
|
var EVIOCSKEYCODE = IOW('E', 0x04, sizeof_uint32p)
|
|
|
-var EVIOCSKEYCODE_V2= IOW('E', 0x04, sizeof_input_keymap_entry)
|
|
|
+var EVIOCSKEYCODE_V2= IOW('E', 0x04, sizeof_INPUT_keymap_entry)
|
|
|
|
|
|
func EVIOCGNAME(len uintptr) uint32{
|
|
|
return IOC(IOC_READ, 'E', 0x06, len)
|
|
@@ -134,7 +134,7 @@ func EVIOCGPROP(len uintptr) uint32 {
|
|
|
*
|
|
|
* The ioctl buffer argument should be binary equivalent to
|
|
|
*
|
|
|
- * type input_mt_request_layout struct {
|
|
|
+ * type INPUT_mt_request_layout struct {
|
|
|
* __u32 code;
|
|
|
* __s32 values[num_slots];
|
|
|
* };
|
|
@@ -177,14 +177,14 @@ func EVIOCGBIT(ev uint32, len uintptr) uint32 {
|
|
|
}
|
|
|
|
|
|
func EVIOCGABS(abs uint32) uint32 {
|
|
|
- return IOR('E', 0x40 + (abs), sizeof_input_absinfo)
|
|
|
+ return IOR('E', 0x40 + (abs), sizeof_INPUT_absinfo)
|
|
|
}
|
|
|
|
|
|
func EVIOCSABS(abs uint32) uint32 {
|
|
|
- return IOW('E', 0xc0 + (abs), sizeof_input_absinfo)
|
|
|
+ return IOW('E', 0xc0 + (abs), sizeof_INPUT_absinfo)
|
|
|
}
|
|
|
|
|
|
-var EVIOCSFF = IOW('E', 0x80, sizeof_ff_effect)
|
|
|
+var EVIOCSFF = IOW('E', 0x80, sizeof_FF_effect)
|
|
|
var EVIOCRMFF = IOW('E', 0x81, sizeof_int32)
|
|
|
var EVIOCGEFFECTS = IOR('E', 0x84, sizeof_int32)
|
|
|
|
|
@@ -195,7 +195,7 @@ var EVIOCREVOKE = IOW('E', 0x91, sizeof_int32)
|
|
|
* EVIOCGMASK - Retrieve current event mask
|
|
|
*
|
|
|
* This ioctl allows user to retrieve the current event mask for specific
|
|
|
- * event type. The argument must be of type "struct input_mask" and
|
|
|
+ * event type. The argument must be of type "struct INPUT_mask" and
|
|
|
* specifies the event type to query, the address of the receive buffer and
|
|
|
* the size of the receive buffer.
|
|
|
*
|
|
@@ -220,7 +220,7 @@ var EVIOCREVOKE = IOW('E', 0x91, sizeof_int32)
|
|
|
* if the receive-buffer points to invalid memory, or EINVAL if the kernel
|
|
|
* does not implement the ioctl.
|
|
|
*/
|
|
|
-var EVIOCGMASK = IOR('E', 0x92, sizeof_input_mask)
|
|
|
+var EVIOCGMASK = IOR('E', 0x92, sizeof_INPUT_mask)
|
|
|
|
|
|
|
|
|
* EVIOCSMASK - Set event mask
|
|
@@ -243,7 +243,7 @@ var EVIOCGMASK = IOR('E', 0x92, sizeof_input_mask)
|
|
|
* returned if the receive-buffer points to invalid memory. EINVAL is returned
|
|
|
* if the kernel does not implement the ioctl.
|
|
|
*/
|
|
|
-var EVIOCSMASK = IOW('E', 0x93, sizeof_input_mask)
|
|
|
+var EVIOCSMASK = IOW('E', 0x93, sizeof_INPUT_mask)
|
|
|
|
|
|
var EVIOCSCLOCKID = IOW('E', 0xa0, sizeof_int32)
|
|
|
|
|
@@ -294,7 +294,7 @@ const FF_STATUS_MAX = 0x01
|
|
|
|
|
|
|
|
|
* Structures used in ioctls to upload effects to a device
|
|
|
- * They are pieces of a bigger structure (called ff_effect)
|
|
|
+ * They are pieces of a bigger structure (called FF_effect)
|
|
|
*/
|
|
|
|
|
|
|
|
@@ -303,27 +303,27 @@ const FF_STATUS_MAX = 0x01
|
|
|
*/
|
|
|
|
|
|
|
|
|
- * struct ff_replay - defines scheduling of the force-feedback effect
|
|
|
+ * struct FF_replay - defines scheduling of the force-feedback effect
|
|
|
* @length: duration of the effect
|
|
|
* @delay: delay before effect should start playing
|
|
|
*/
|
|
|
-type ff_replay struct {
|
|
|
+type FF_replay struct {
|
|
|
length uint16
|
|
|
delay uint16
|
|
|
};
|
|
|
|
|
|
|
|
|
- * struct ff_trigger - defines what triggers the force-feedback effect
|
|
|
+ * struct FF_trigger - defines what triggers the force-feedback effect
|
|
|
* @button: number of the button triggering the effect
|
|
|
* @interval: controls how soon the effect can be re-triggered
|
|
|
*/
|
|
|
-type ff_trigger struct {
|
|
|
+type FF_trigger struct {
|
|
|
button uint16
|
|
|
interval uint16
|
|
|
};
|
|
|
|
|
|
|
|
|
- * struct ff_envelope - generic force-feedback effect envelope
|
|
|
+ * struct FF_envelope - generic force-feedback effect envelope
|
|
|
* @attack_length: duration of the attack (ms)
|
|
|
* @attack_level: level at the beginning of the attack
|
|
|
* @fade_length: duration of fade (ms)
|
|
@@ -334,7 +334,7 @@ type ff_trigger struct {
|
|
|
* value based on polarity of the default level of the effect.
|
|
|
* Valid range for the attack and fade levels is 0x0000 - 0x7fff
|
|
|
*/
|
|
|
-type ff_envelope struct {
|
|
|
+type FF_envelope struct {
|
|
|
attack_length uint16
|
|
|
attack_level uint16
|
|
|
fade_length uint16
|
|
@@ -342,29 +342,29 @@ type ff_envelope struct {
|
|
|
};
|
|
|
|
|
|
|
|
|
- * struct ff_constant_effect - defines parameters of a constant force-feedback effect
|
|
|
+ * struct FF_constant_effect - defines parameters of a constant force-feedback effect
|
|
|
* @level: strength of the effect; may be negative
|
|
|
* @envelope: envelope data
|
|
|
*/
|
|
|
-type ff_constant_effect struct {
|
|
|
+type FF_constant_effect struct {
|
|
|
level int16
|
|
|
- envelope ff_envelope
|
|
|
+ envelope FF_envelope
|
|
|
};
|
|
|
|
|
|
|
|
|
- * struct ff_ramp_effect - defines parameters of a ramp force-feedback effect
|
|
|
+ * struct FF_ramp_effect - defines parameters of a ramp force-feedback effect
|
|
|
* @start_level: beginning strength of the effect; may be negative
|
|
|
* @end_level: final strength of the effect; may be negative
|
|
|
* @envelope: envelope data
|
|
|
*/
|
|
|
-type ff_ramp_effect struct {
|
|
|
+type FF_ramp_effect struct {
|
|
|
start_level int16
|
|
|
end_level int16
|
|
|
- envelope ff_envelope
|
|
|
+ envelope FF_envelope
|
|
|
};
|
|
|
|
|
|
|
|
|
- * struct ff_condition_effect - defines a spring or friction force-feedback effect
|
|
|
+ * struct FF_condition_effect - defines a spring or friction force-feedback effect
|
|
|
* @right_saturation: maximum level when joystick moved all way to the right
|
|
|
* @left_saturation: same for the left side
|
|
|
* @right_coeff: controls how fast the force grows when the joystick moves
|
|
@@ -373,7 +373,7 @@ type ff_ramp_effect struct {
|
|
|
* @deadband: size of the dead zone, where no force is produced
|
|
|
* @center: position of the dead zone
|
|
|
*/
|
|
|
-type ff_condition_effect struct {
|
|
|
+type FF_condition_effect struct {
|
|
|
right_saturation uint16
|
|
|
left_saturation uint16
|
|
|
|
|
@@ -385,7 +385,7 @@ type ff_condition_effect struct {
|
|
|
};
|
|
|
|
|
|
|
|
|
- * struct ff_periodic_effect - defines parameters of a periodic force-feedback effect
|
|
|
+ * struct FF_periodic_effect - defines parameters of a periodic force-feedback effect
|
|
|
* @waveform: kind of the effect (wave)
|
|
|
* @period: period of the wave (ms)
|
|
|
* @magnitude: peak value
|
|
@@ -402,44 +402,44 @@ type ff_condition_effect struct {
|
|
|
* Note: the data pointed by custom_data is copied by the driver.
|
|
|
* You can therefore dispose of the memory after the upload/update.
|
|
|
*/
|
|
|
-type ff_periodic_effect struct {
|
|
|
+type FF_periodic_effect struct {
|
|
|
waveform uint16
|
|
|
period uint16
|
|
|
magnitude int16
|
|
|
offset int16
|
|
|
phase uint16
|
|
|
|
|
|
- envelope ff_envelope
|
|
|
+ envelope FF_envelope
|
|
|
|
|
|
custom_len uint32
|
|
|
custom_data *int16;
|
|
|
};
|
|
|
|
|
|
|
|
|
- * struct ff_rumble_effect - defines parameters of a periodic force-feedback effect
|
|
|
+ * struct FF_rumble_effect - defines parameters of a periodic force-feedback effect
|
|
|
* @strong_magnitude: magnitude of the heavy motor
|
|
|
* @weak_magnitude: magnitude of the light one
|
|
|
*
|
|
|
* Some rumble pads have two motors of different weight. Strong_magnitude
|
|
|
* represents the magnitude of the vibration generated by the heavy one.
|
|
|
*/
|
|
|
-type ff_rumble_effect struct {
|
|
|
+type FF_rumble_effect struct {
|
|
|
strong_magnitude uint16
|
|
|
weak_magnitude uint16
|
|
|
};
|
|
|
|
|
|
-const ff_effect_union_size = unsafe.Sizeof(*((*ff_periodic_effect)(nil)))
|
|
|
+const FF_effect_union_size = unsafe.Sizeof(*((*FF_periodic_effect)(nil)))
|
|
|
|
|
|
|
|
|
- * struct ff_effect - defines force feedback effect
|
|
|
+ * struct FF_effect - defines force feedback effect
|
|
|
* @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING,
|
|
|
* FF_FRICTION, FF_DAMPER, FF_RUMBLE, FFINERTIA, or FF_CUSTOM)
|
|
|
* @id: an unique id assigned to an effect
|
|
|
* @direction: direction of the effect
|
|
|
- * @trigger: trigger conditions (struct ff_trigger)
|
|
|
- * @replay: scheduling of the effect (struct ff_replay)
|
|
|
- * @u: effect-specific structure (one of ff_constant_effect, ff_ramp_effect,
|
|
|
- * ff_periodic_effect, ff_condition_effect, ff_rumble_effect) further
|
|
|
+ * @trigger: trigger conditions (struct FF_trigger)
|
|
|
+ * @replay: scheduling of the effect (struct FF_replay)
|
|
|
+ * @u: effect-specific structure (one of FF_constant_effect, FF_ramp_effect,
|
|
|
+ * FF_periodic_effect, FF_condition_effect, FF_rumble_effect) further
|
|
|
* defining effect parameters
|
|
|
*
|
|
|
* This structure is sent through ioctl from the application to the driver.
|
|
@@ -453,61 +453,61 @@ const ff_effect_union_size = unsafe.Sizeof(*((*ff_periodic_effect)(nil)))
|
|
|
* 180 deg -> 0x8000 (up)
|
|
|
* 270 deg -> 0xC000 (right)
|
|
|
*/
|
|
|
-type ff_effect struct {
|
|
|
+type FF_effect struct {
|
|
|
type_ uint16
|
|
|
id int16
|
|
|
direction uint16
|
|
|
- trigger ff_trigger
|
|
|
- replay ff_replay
|
|
|
+ trigger FF_trigger
|
|
|
+ replay FF_replay
|
|
|
|
|
|
- u [ff_effect_union_size]byte
|
|
|
+ u [FF_effect_union_size]byte
|
|
|
};
|
|
|
|
|
|
-type ff_effect_u_constant struct {
|
|
|
+type FF_effect_u_constant struct {
|
|
|
type_ uint16
|
|
|
id int16
|
|
|
direction uint16
|
|
|
- trigger ff_trigger
|
|
|
- replay ff_replay
|
|
|
- constant ff_constant_effect
|
|
|
+ trigger FF_trigger
|
|
|
+ replay FF_replay
|
|
|
+ constant FF_constant_effect
|
|
|
};
|
|
|
|
|
|
|
|
|
-type ff_effect_u_ramp struct {
|
|
|
+type FF_effect_u_ramp struct {
|
|
|
type_ uint16
|
|
|
id int16
|
|
|
direction uint16
|
|
|
- trigger ff_trigger
|
|
|
- replay ff_replay
|
|
|
- ramp ff_ramp_effect
|
|
|
+ trigger FF_trigger
|
|
|
+ replay FF_replay
|
|
|
+ ramp FF_ramp_effect
|
|
|
};
|
|
|
|
|
|
|
|
|
-type ff_effect_u_periodic struct {
|
|
|
+type FF_effect_u_periodic struct {
|
|
|
type_ uint16
|
|
|
id int16
|
|
|
direction uint16
|
|
|
- trigger ff_trigger
|
|
|
- replay ff_replay
|
|
|
- periodic ff_periodic_effect
|
|
|
+ trigger FF_trigger
|
|
|
+ replay FF_replay
|
|
|
+ periodic FF_periodic_effect
|
|
|
};
|
|
|
|
|
|
-type ff_effect_u_condition struct {
|
|
|
+type FF_effect_u_condition struct {
|
|
|
type_ uint16
|
|
|
id int16
|
|
|
direction uint16
|
|
|
- trigger ff_trigger
|
|
|
- replay ff_replay
|
|
|
- condition [2]ff_condition_effect;
|
|
|
+ trigger FF_trigger
|
|
|
+ replay FF_replay
|
|
|
+ condition [2]FF_condition_effect;
|
|
|
};
|
|
|
|
|
|
-type ff_effect_u_rumble struct {
|
|
|
+type FF_effect_u_rumble struct {
|
|
|
type_ uint16
|
|
|
id int16
|
|
|
direction uint16
|
|
|
- trigger ff_trigger
|
|
|
- replay ff_replay
|
|
|
- rumble ff_rumble_effect
|
|
|
+ trigger FF_trigger
|
|
|
+ replay FF_replay
|
|
|
+ rumble FF_rumble_effect
|
|
|
};
|
|
|
|
|
|
|