aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/input.h
diff options
context:
space:
mode:
authorAnssi Hannula <anssi.hannula@gmail.com>2006-07-19 01:44:22 -0400
committerDmitry Torokhov <dtor@insightbb.com>2006-07-19 01:44:22 -0400
commit8b8277a17477de38d8df6783e8221aed55bab300 (patch)
tree20988680a957d453d273d7b9a86e929dc19c73e9 /include/linux/input.h
parentbb3caf7f438a67452f5cf4773ca1bf82260bbbad (diff)
Input: update the force feedback documentation
Signed-off-by: Anssi Hannula <anssi.hannula@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'include/linux/input.h')
-rw-r--r--include/linux/input.h175
1 files changed, 122 insertions, 53 deletions
diff --git a/include/linux/input.h b/include/linux/input.h
index 4405d0283549..a7a1f55a5eed 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -667,98 +667,167 @@ struct input_absinfo {
667 667
668/* 668/*
669 * Structures used in ioctls to upload effects to a device 669 * Structures used in ioctls to upload effects to a device
670 * The first structures are not passed directly by using ioctls. 670 * They are pieces of a bigger structure (called ff_effect)
671 * They are sub-structures of the actually sent structure (called ff_effect)
672 */ 671 */
673 672
673/*
674 * All duration values are expressed in ms. Values above 32767 ms (0x7fff)
675 * should not be used and have unspecified results.
676 */
677
678/**
679 * struct ff_replay - defines scheduling of the effect
680 * @length: duration of the effect
681 * @delay: delay before effect should start playing
682 */
674struct ff_replay { 683struct ff_replay {
675 __u16 length; /* Duration of an effect in ms. All other times are also expressed in ms */ 684 __u16 length;
676 __u16 delay; /* Time to wait before to start playing an effect */ 685 __u16 delay;
677}; 686};
678 687
688/**
689 * struct ff_trigger - defines what triggers the effect
690 * @button: number of the button triggering the effect
691 * @interval: controls how soon the effect can be re-triggered
692 */
679struct ff_trigger { 693struct ff_trigger {
680 __u16 button; /* Number of button triggering an effect */ 694 __u16 button;
681 __u16 interval; /* Time to wait before an effect can be re-triggered (ms) */ 695 __u16 interval;
682}; 696};
683 697
698/**
699 * struct ff_envelope - generic effect envelope
700 * @attack_length: duration of the attack (ms)
701 * @attack_level: level at the beginning of the attack
702 * @fade_length: duration of fade (ms)
703 * @fade_level: level at the end of fade
704 *
705 * The @attack_level and @fade_level are absolute values; when applying
706 * envelope force-feedback core will convert to positive/negative
707 * value based on polarity of the default level of the effect.
708 * Valid range for the attack and fade levels is 0x0000 - 0x7fff
709 */
684struct ff_envelope { 710struct ff_envelope {
685 __u16 attack_length; /* Duration of attack (ms) */ 711 __u16 attack_length;
686 __u16 attack_level; /* Level at beginning of attack */ 712 __u16 attack_level;
687 __u16 fade_length; /* Duration of fade (ms) */ 713 __u16 fade_length;
688 __u16 fade_level; /* Level at end of fade */ 714 __u16 fade_level;
689}; 715};
690 716
691/* FF_CONSTANT */ 717/**
718 * struct ff_constant_effect - defines parameters of a constant effect
719 * @level: strength of the effect; may be negative
720 * @envelope: envelope data
721 */
692struct ff_constant_effect { 722struct ff_constant_effect {
693 __s16 level; /* Strength of effect. Negative values are OK */ 723 __s16 level;
694 struct ff_envelope envelope; 724 struct ff_envelope envelope;
695}; 725};
696 726
697/* FF_RAMP */ 727/**
728 * struct ff_ramp_effect - defines parameters of a ramp effect
729 * @start_level: beginning strength of the effect; may be negative
730 * @end_level: final strength of the effect; may be negative
731 * @envelope: envelope data
732 */
698struct ff_ramp_effect { 733struct ff_ramp_effect {
699 __s16 start_level; 734 __s16 start_level;
700 __s16 end_level; 735 __s16 end_level;
701 struct ff_envelope envelope; 736 struct ff_envelope envelope;
702}; 737};
703 738
704/* FF_SPRING of FF_FRICTION */ 739/**
740 * struct ff_condition_effect - defines a spring or friction effect
741 * @right_saturation: maximum level when joystick moved all way to the right
742 * @left_saturation: same for the left side
743 * @right_coeff: controls how fast the force grows when the joystick moves
744 * to the right
745 * @left_coeff: same for the left side
746 * @deadband: size of the dead zone, where no force is produced
747 * @center: position of the dead zone
748 */
705struct ff_condition_effect { 749struct ff_condition_effect {
706 __u16 right_saturation; /* Max level when joystick is on the right */ 750 __u16 right_saturation;
707 __u16 left_saturation; /* Max level when joystick in on the left */ 751 __u16 left_saturation;
708 752
709 __s16 right_coeff; /* Indicates how fast the force grows when the 753 __s16 right_coeff;
710 joystick moves to the right */ 754 __s16 left_coeff;
711 __s16 left_coeff; /* Same for left side */
712
713 __u16 deadband; /* Size of area where no force is produced */
714 __s16 center; /* Position of dead zone */
715 755
756 __u16 deadband;
757 __s16 center;
716}; 758};
717 759
718/* FF_PERIODIC */ 760/**
761 * struct ff_periodic_effect - defines parameters of a periodic effect
762 * @waveform: kind of the effect (wave)
763 * @period: period of the wave (ms)
764 * @magnitude: peak value
765 * @offset: mean value of the wave (roughly)
766 * @phase: 'horizontal' shift
767 * @envelope: envelope data
768 * @custom_len: number of samples (FF_CUSTOM only)
769 * @custom_data: buffer of samples (FF_CUSTOM only)
770 *
771 * Known waveforms - FF_SQUARE, FF_TRIANGLE, FF_SINE, FF_SAW_UP,
772 * FF_SAW_DOWN, FF_CUSTOM. The exact syntax FF_CUSTOM is undefined
773 * for the time being as no driver supports it yet.
774 *
775 * Note: the data pointed by custom_data is copied by the driver.
776 * You can therefore dispose of the memory after the upload/update.
777 */
719struct ff_periodic_effect { 778struct ff_periodic_effect {
720 __u16 waveform; /* Kind of wave (sine, square...) */ 779 __u16 waveform;
721 __u16 period; /* in ms */ 780 __u16 period;
722 __s16 magnitude; /* Peak value */ 781 __s16 magnitude;
723 __s16 offset; /* Mean value of wave (roughly) */ 782 __s16 offset;
724 __u16 phase; /* 'Horizontal' shift */ 783 __u16 phase;
725 784
726 struct ff_envelope envelope; 785 struct ff_envelope envelope;
727 786
728/* Only used if waveform == FF_CUSTOM */ 787 __u32 custom_len;
729 __u32 custom_len; /* Number of samples */ 788 __s16 *custom_data;
730 __s16 *custom_data; /* Buffer of samples */
731/* Note: the data pointed by custom_data is copied by the driver. You can
732 * therefore dispose of the memory after the upload/update */
733}; 789};
734 790
735/* FF_RUMBLE */ 791/**
736/* Some rumble pads have two motors of different weight. 792 * struct ff_rumble_effect - defines parameters of a periodic effect
737 strong_magnitude represents the magnitude of the vibration generated 793 * @strong_magnitude: magnitude of the heavy motor
738 by the heavy motor. 794 * @weak_magnitude: magnitude of the light one
739*/ 795 *
796 * Some rumble pads have two motors of different weight. Strong_magnitude
797 * represents the magnitude of the vibration generated by the heavy one.
798 */
740struct ff_rumble_effect { 799struct ff_rumble_effect {
741 __u16 strong_magnitude; /* Magnitude of the heavy motor */ 800 __u16 strong_magnitude;
742 __u16 weak_magnitude; /* Magnitude of the light one */ 801 __u16 weak_magnitude;
743}; 802};
744 803
745/* 804/**
746 * Structure sent through ioctl from the application to the driver 805 * struct ff_effect - defines force feedback effect
806 * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING,
807 * FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_INERTIA, or FF_CUSTOM)
808 * @id: an unique id assigned to an effect
809 * @direction: direction of the effect
810 * @trigger: trigger conditions (struct ff_trigger)
811 * @replay: scheduling of the effect (struct ff_replay)
812 * @u: effect-specific structure (one of ff_constant_effect, ff_ramp_effect,
813 * ff_periodic_effect, ff_condition_effect, ff_rumble_effect) further
814 * defining effect parameters
815 *
816 * This structure is sent through ioctl from the application to the driver.
817 * To create a new effect aplication should set its @id to -1; the kernel
818 * will return assigned @id which can later be used to update or delete
819 * this effect.
820 *
821 * Direction of the effect is encoded as follows:
822 * 0 deg -> 0x0000 (down)
823 * 90 deg -> 0x4000 (left)
824 * 180 deg -> 0x8000 (up)
825 * 270 deg -> 0xC000 (right)
747 */ 826 */
748struct ff_effect { 827struct ff_effect {
749 __u16 type; 828 __u16 type;
750/* Following field denotes the unique id assigned to an effect.
751 * If user sets if to -1, a new effect is created, and its id is returned in the same field
752 * Else, the user sets it to the effect id it wants to update.
753 */
754 __s16 id; 829 __s16 id;
755 830 __u16 direction;
756 __u16 direction; /* Direction. 0 deg -> 0x0000 (down)
757 90 deg -> 0x4000 (left)
758 180 deg -> 0x8000 (up)
759 270 deg -> 0xC000 (right)
760 */
761
762 struct ff_trigger trigger; 831 struct ff_trigger trigger;
763 struct ff_replay replay; 832 struct ff_replay replay;
764 833