src/joystick/bsd/SDL_sysjoystick.c
changeset 405 b5de7389a0a5
parent 404 cbb346aca05d
child 407 173909e17b7f
equal deleted inserted replaced
404:cbb346aca05d 405:b5de7389a0a5
    30 #ifdef SAVE_RCSID
    30 #ifdef SAVE_RCSID
    31 static char rcsid =
    31 static char rcsid =
    32  "@(#) $Id $";
    32  "@(#) $Id $";
    33 #endif
    33 #endif
    34 
    34 
    35 #include <sys/types.h>
       
    36 #include <stdio.h>
    35 #include <stdio.h>
    37 #include <stdlib.h>
    36 #include <stdlib.h>
    38 #include <unistd.h>
    37 #include <unistd.h>
    39 #include <fcntl.h>
    38 #include <fcntl.h>
    40 #include <string.h>
    39 #include <string.h>
   240 				}
   239 				}
   241 			}
   240 			}
   242 			break;
   241 			break;
   243 		case hid_input:
   242 		case hid_input:
   244 			switch (HID_PAGE(hitem.usage)) {
   243 			switch (HID_PAGE(hitem.usage)) {
   245 			case HUP_UNDEFINED:
       
   246 				break;
       
   247 			case HUP_GENERIC_DESKTOP:
   244 			case HUP_GENERIC_DESKTOP:
   248 				switch (HID_USAGE(hitem.usage)) {
   245 				switch (HID_USAGE(hitem.usage)) {
   249 				case HUG_X:
   246 				case HUG_X:
   250 				case HUG_Y:
   247 				case HUG_Y:
   251 				case HUG_Z:
   248 				case HUG_Z:
   262 				}
   259 				}
   263 				break;
   260 				break;
   264 			case HUP_BUTTON:
   261 			case HUP_BUTTON:
   265 				joy->nbuttons++;
   262 				joy->nbuttons++;
   266 				break;
   263 				break;
       
   264 			default:
       
   265 				break;
   267 			}
   266 			}
   268 			break;
   267 			break;
   269 		default:
   268 		default:
   270 			break;
   269 			break;
   271 		}
   270 		}
   306 
   305 
   307 	for (nbutton = 0; hid_get_item(hdata, &hitem) > 0;) {
   306 	for (nbutton = 0; hid_get_item(hdata, &hitem) > 0;) {
   308 		switch (hitem.kind) {
   307 		switch (hitem.kind) {
   309 		case hid_input:
   308 		case hid_input:
   310 			switch (HID_PAGE(hitem.usage)) {
   309 			switch (HID_PAGE(hitem.usage)) {
   311 			case HUP_UNDEFINED:
       
   312 				continue;
       
   313 			case HUP_GENERIC_DESKTOP:
   310 			case HUP_GENERIC_DESKTOP:
   314 				switch (HID_USAGE(hitem.usage)) {
   311 				switch (HID_USAGE(hitem.usage)) {
   315 				case HUG_X:
   312 				case HUG_X:
   316 					naxe = JOYAXE_X;
   313 					naxe = JOYAXE_X;
   317 					goto scaleaxe;
   314 					goto scaleaxe;
   355 					SDL_PrivateJoystickButton(joy,
   352 					SDL_PrivateJoystickButton(joy,
   356 					    nbutton, v);
   353 					    nbutton, v);
   357 				}
   354 				}
   358 				nbutton++;
   355 				nbutton++;
   359 				break;
   356 				break;
       
   357 			default:
       
   358 				continue;
   360 			}
   359 			}
   361 			break;
   360 			break;
   362 		default:
   361 		default:
   363 			break;
   362 			break;
   364 		}
   363 		}