Mercurial > sdl-ios-xcode
comparison src/video/qnxgf/SDL_gf_input.h @ 3109:7b3a09fb9c8b
Support for HID devices (mice and keyboards only for now) has been added
author | Mike Gorchak <lestat@i.com.ua> |
---|---|
date | Tue, 28 Apr 2009 04:33:30 +0000 |
parents | |
children | 7f684f249ec9 |
comparison
equal
deleted
inserted
replaced
3108:aa1897bee1e9 | 3109:7b3a09fb9c8b |
---|---|
1 /* | |
2 SDL - Simple DirectMedia Layer | |
3 Copyright (C) 1997-2009 Sam Lantinga | |
4 | |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Lesser General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2.1 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Lesser General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Lesser General Public | |
16 License along with this library; if not, write to the Free Software | |
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
18 | |
19 Sam Lantinga | |
20 slouken@libsdl.org | |
21 | |
22 QNX Graphics Framework SDL driver | |
23 Copyright (C) 2009 Mike Gorchak | |
24 (mike@malva.ua, lestat@i.com.ua) | |
25 */ | |
26 | |
27 #ifndef __SDL_GF_INPUT_H__ | |
28 #define __SDL_GF_INPUT_H__ | |
29 | |
30 #include "SDL_config.h" | |
31 #include "SDL_video.h" | |
32 #include "../SDL_sysvideo.h" | |
33 | |
34 #include <errno.h> | |
35 | |
36 #include <gf/gf.h> | |
37 | |
38 #include <sys/hiddi.h> | |
39 #include <sys/hidut.h> | |
40 | |
41 #include "SDL_qnxgf.h" | |
42 | |
43 typedef struct SDL_MouseData | |
44 { | |
45 SDL_DisplayData* didata; | |
46 } SDL_MouseData; | |
47 | |
48 int32_t gf_addinputdevices(_THIS); | |
49 int32_t gf_delinputdevices(_THIS); | |
50 | |
51 #define SDL_GF_MOUSE_COLOR_BLACK 0xFF000000 | |
52 #define SDL_GF_MOUSE_COLOR_WHITE 0xFFFFFFFF | |
53 #define SDL_GF_MOUSE_COLOR_TRANS 0x00000000 | |
54 | |
55 /*****************************************************************************/ | |
56 /* This is HIDDI closed interface declarations */ | |
57 /*****************************************************************************/ | |
58 #define HID_TYPE_MAIN 0x0 | |
59 #define HID_TYPE_GLOBAL 0x1 | |
60 #define HID_TYPE_LOCAL 0x2 | |
61 #define HID_TYPE_RESERVED 0x3 | |
62 | |
63 #define HID_GLOBAL_USAGE_PAGE 0x0 | |
64 #define HID_LOCAL_USAGE 0x0 | |
65 | |
66 typedef struct _hid_byte | |
67 { | |
68 uint8_t HIDB_Length; | |
69 uint8_t HIDB_Type; | |
70 uint8_t HIDB_Tag; | |
71 uint8_t reserved[1]; | |
72 } hid_byte_t; | |
73 | |
74 typedef struct _hidd_global_item | |
75 { | |
76 uint16_t usage_page; | |
77 uint16_t logical_min; | |
78 uint16_t logical_max; | |
79 uint16_t physical_min; | |
80 uint16_t physical_max; | |
81 uint16_t unit_expo; | |
82 uint16_t unit; | |
83 uint16_t report_size; | |
84 uint16_t report_id; | |
85 uint16_t report_count; | |
86 } hidd_global_item_t; | |
87 | |
88 typedef struct _hidd_local_item | |
89 { | |
90 uint16_t type; | |
91 uint8_t reserved[2]; | |
92 uint32_t value; | |
93 struct _hidd_local_item* next_local; | |
94 struct _hidd_local_item* alt_local; | |
95 } hidd_local_item_t; | |
96 | |
97 typedef struct _hidd_local_table | |
98 { | |
99 hidd_local_item_t* usage_info; | |
100 hidd_local_item_t* designator_info; | |
101 hidd_local_item_t* string_info; | |
102 uint8_t delimiter; | |
103 uint8_t reserved[3]; | |
104 } hidd_local_table_t; | |
105 | |
106 typedef struct _hidd_field | |
107 { | |
108 struct hidd_report_instance* report; | |
109 struct hidd_collection* collection; | |
110 uint16_t report_offset; | |
111 uint16_t flags; | |
112 hidd_global_item_t gitem; | |
113 hidd_local_table_t* ltable; | |
114 struct _hidd_field* next_field; | |
115 void* user; | |
116 } hidd_field_t; | |
117 | |
118 typedef struct hidd_report_instance | |
119 { | |
120 uint8_t report_id; | |
121 uint8_t reserved[1]; | |
122 uint16_t report_type; | |
123 hidd_field_t* field; | |
124 uint16_t num_field; | |
125 uint16_t byte_len; | |
126 uint16_t bit_len; | |
127 uint8_t reserved2[2]; | |
128 struct hidd_collection* collection; | |
129 struct hidd_report_instance* next_col_report; | |
130 struct hidd_report_instance* next_report; | |
131 } hidd_report_instance_t; | |
132 | |
133 typedef struct hidd_report | |
134 { | |
135 TAILQ_ENTRY(hidd_report) link; | |
136 hidd_report_instance_t* rinst; | |
137 hidd_device_instance_t* dev_inst; | |
138 uint32_t flags; | |
139 struct hidd_connection* connection; | |
140 void* user; | |
141 } hidd_report_t; | |
142 | |
143 typedef struct hidview_device | |
144 { | |
145 struct hidd_report_instance* instance; | |
146 struct hidd_report* report; | |
147 } hidview_device_t; | |
148 | |
149 /*****************************************************************************/ | |
150 /* Closed HIDDI interface declarations end */ | |
151 /*****************************************************************************/ | |
152 | |
153 /* Maximum devices and subdevices amount per host */ | |
154 #define SDL_HIDDI_MAX_DEVICES 64 | |
155 | |
156 /* Detected device/subdevice type for SDL */ | |
157 #define SDL_GF_HIDDI_NONE 0x00000000 | |
158 #define SDL_GF_HIDDI_MOUSE 0x00000001 | |
159 #define SDL_GF_HIDDI_KEYBOARD 0x00000002 | |
160 #define SDL_GF_HIDDI_JOYSTICK 0x00000003 | |
161 | |
162 extern void hiddi_enable_mouse(); | |
163 extern void hiddi_disable_mouse(); | |
164 | |
165 #endif /* __SDL_GF_INPUT_H__ */ |