3 #include "CJoyStickG25.h"
5 CJoyStickG25::CJoyStickG25() : CJoyStickEV() {
8 CJoyStickG25::~CJoyStickG25() {
11 int CJoyStickG25::Open() {
12 m_devName = std::string(D_DEV_NAME_G25);
13 int rfd = CJoyStickEV::Open();
18 if (0 > ioctl(rfd, EVIOCGABS(ABS_X), &m_absInf[E_ABSX])) {
19 std::cerr << "ioctl(EVIOCGABS(ABS_X)) get error" << std::endl;
20 m_absInf[E_ABSX].minimum = 0;
21 m_absInf[E_ABSX].maximum = 16384;
23 if (0 > ioctl(rfd, EVIOCGABS(ABS_Y), &m_absInf[E_ABSY])) {
24 std::cerr << "ioctl(EVIOCGABS(ABS_Y)) get error" << std::endl;
25 m_absInf[E_ABSY].minimum = -32767;
26 m_absInf[E_ABSY].maximum = 32767;
28 if (0 > ioctl(rfd, EVIOCGABS(ABS_Z), &m_absInf[E_ABSZ])) {
29 std::cerr << "ioctl(EVIOCGABS(ABS_Z)) get error" << std::endl;
30 m_absInf[E_ABSZ].minimum = -32767;
31 m_absInf[E_ABSZ].maximum = 32767;
33 if (0 > ioctl(rfd, EVIOCGABS(ABS_HAT0X), &m_absInf[E_ABSHAT0X])) {
34 std::cerr << "ioctl(EVIOCGABS(ABS_HAT0X)) get error" << std::endl;
35 m_absInf[E_ABSHAT0X].minimum = -1;
36 m_absInf[E_ABSHAT0X].maximum = 1;
38 if (0 > ioctl(rfd, EVIOCGABS(ABS_HAT0Y), &m_absInf[E_ABSHAT0Y])) {
39 std::cerr << "ioctl(EVIOCGABS(ABS_HAT0Y)) get error" << std::endl;
40 m_absInf[E_ABSHAT0Y].minimum = -1;
41 m_absInf[E_ABSHAT0Y].maximum = 1;
47 * @brief change input_event value to js_event value
48 * Since the direction of change value is different from the G27.
50 int CJoyStickG25::getJS_EVENT_AXIS(int& num, int& val,
51 const struct input_event& s)
56 // Convert value Steering
57 // 0 to 16353 -> -32766 to 32767
60 val = calc1pm32767((int)s.value, m_absInf[E_ABSX]);
65 val = calc3p32767Reverse((int)s.value, m_absInf[E_ABSY]);
70 val = calc3p32767((int)s.value, m_absInf[E_ABSZ]);
75 val = calc3p32767Reverse((int)s.value, m_absInf[E_ABSRZ]);