fix dependency
[profile/ivi/ico-vic-carsimulator.git] / src / CJoyStickG27.cpp
1 #include <iostream>
2
3 #include "CJoyStickG27.h"
4
5 CJoyStickG27::CJoyStickG27() : CJoyStickEV() {
6 }
7
8 CJoyStickG27::~CJoyStickG27() {
9 }
10
11 int CJoyStickG27::Open() {
12     m_devName = std::string(D_DEV_NAME_G27);
13     int rfd = CJoyStickEV::Open();
14     if (rfd < 0) {
15         return rfd;
16     }
17
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;
22     }
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 = 0;
26         m_absInf[E_ABSY].maximum = 255;
27     }
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 = 0;
31         m_absInf[E_ABSZ].maximum = 255;
32     }
33     if (0 > ioctl(rfd, EVIOCGABS(ABS_RZ), &m_absInf[E_ABSRZ])) {
34         std::cerr << "ioctl(EVIOCGABS(ABS_RZ)) get error" << std::endl;
35         m_absInf[E_ABSRZ].minimum = 0;
36         m_absInf[E_ABSRZ].maximum = 255;
37     }
38     if (0 > ioctl(rfd, EVIOCGABS(ABS_HAT0X), &m_absInf[E_ABSHAT0X])) {
39         std::cerr << "ioctl(EVIOCGABS(ABS_HAT0X)) get error" << std::endl;
40         m_absInf[E_ABSHAT0X].minimum = -1;
41         m_absInf[E_ABSHAT0X].maximum = 1;
42     }
43     if (0 > ioctl(rfd, EVIOCGABS(ABS_HAT0Y), &m_absInf[E_ABSHAT0Y])) {
44         std::cerr << "ioctl(EVIOCGABS(ABS_HAT0Y)) get error" << std::endl;
45         m_absInf[E_ABSHAT0Y].minimum = -1;
46         m_absInf[E_ABSHAT0Y].maximum = 1;
47     }
48     return rfd;
49 }
50