logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

joystick.h (3434B)


  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. /*
  3. * Copyright (C) 1996-2000 Vojtech Pavlik
  4. *
  5. * Sponsored by SuSE
  6. */
  7. /*
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. */
  22. #ifndef _LINUX_JOYSTICK_H
  23. #define _LINUX_JOYSTICK_H
  24. #include <linux/types.h>
  25. #include <linux/input.h>
  26. /*
  27. * Version
  28. */
  29. #define JS_VERSION 0x020100
  30. /*
  31. * Types and constants for reading from /dev/js
  32. */
  33. #define JS_EVENT_BUTTON 0x01 /* button pressed/released */
  34. #define JS_EVENT_AXIS 0x02 /* joystick moved */
  35. #define JS_EVENT_INIT 0x80 /* initial state of device */
  36. struct js_event {
  37. __u32 time; /* event timestamp in milliseconds */
  38. __s16 value; /* value */
  39. __u8 type; /* event type */
  40. __u8 number; /* axis/button number */
  41. };
  42. /*
  43. * IOCTL commands for joystick driver
  44. */
  45. #define JSIOCGVERSION _IOR('j', 0x01, __u32) /* get driver version */
  46. #define JSIOCGAXES _IOR('j', 0x11, __u8) /* get number of axes */
  47. #define JSIOCGBUTTONS _IOR('j', 0x12, __u8) /* get number of buttons */
  48. #define JSIOCGNAME(len) _IOC(_IOC_READ, 'j', 0x13, len) /* get identifier string */
  49. #define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */
  50. #define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */
  51. #define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_CNT]) /* set axis mapping */
  52. #define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_CNT]) /* get axis mapping */
  53. #define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */
  54. #define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */
  55. /*
  56. * Types and constants for get/set correction
  57. */
  58. #define JS_CORR_NONE 0x00 /* returns raw values */
  59. #define JS_CORR_BROKEN 0x01 /* broken line */
  60. struct js_corr {
  61. __s32 coef[8];
  62. __s16 prec;
  63. __u16 type;
  64. };
  65. /*
  66. * v0.x compatibility definitions
  67. */
  68. #define JS_RETURN sizeof(struct JS_DATA_TYPE)
  69. #define JS_TRUE 1
  70. #define JS_FALSE 0
  71. #define JS_X_0 0x01
  72. #define JS_Y_0 0x02
  73. #define JS_X_1 0x04
  74. #define JS_Y_1 0x08
  75. #define JS_MAX 2
  76. #define JS_DEF_TIMEOUT 0x1300
  77. #define JS_DEF_CORR 0
  78. #define JS_DEF_TIMELIMIT 10L
  79. #define JS_SET_CAL 1
  80. #define JS_GET_CAL 2
  81. #define JS_SET_TIMEOUT 3
  82. #define JS_GET_TIMEOUT 4
  83. #define JS_SET_TIMELIMIT 5
  84. #define JS_GET_TIMELIMIT 6
  85. #define JS_GET_ALL 7
  86. #define JS_SET_ALL 8
  87. struct JS_DATA_TYPE {
  88. __s32 buttons;
  89. __s32 x;
  90. __s32 y;
  91. };
  92. struct JS_DATA_SAVE_TYPE_32 {
  93. __s32 JS_TIMEOUT;
  94. __s32 BUSY;
  95. __s32 JS_EXPIRETIME;
  96. __s32 JS_TIMELIMIT;
  97. struct JS_DATA_TYPE JS_SAVE;
  98. struct JS_DATA_TYPE JS_CORR;
  99. };
  100. struct JS_DATA_SAVE_TYPE_64 {
  101. __s32 JS_TIMEOUT;
  102. __s32 BUSY;
  103. __s64 JS_EXPIRETIME;
  104. __s64 JS_TIMELIMIT;
  105. struct JS_DATA_TYPE JS_SAVE;
  106. struct JS_DATA_TYPE JS_CORR;
  107. };
  108. #endif /* _LINUX_JOYSTICK_H */