1 /* 2 * Copyright 2008, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Fredrik Modeen 7 */ 8 9 #include "joystick_driver.h" 10 11 #include <List.h> 12 #include <Entry.h> 13 14 #define DEVICEPATH "/dev/joystick/" 15 #define JOYSTICKPATH "/boot/home/config/settings/joysticks/" 16 17 class BJoystick; 18 19 typedef struct _joystick_info { 20 char module_name[64]; 21 char controller_name[64]; 22 int16 num_axes; 23 int16 num_buttons; 24 int16 num_hats; 25 uint32 num_sticks; 26 bool calibration_enable; 27 bigtime_t max_latency; 28 BList name_axis; 29 BList name_hat; 30 BList name_button; 31 // BList name_ 32 } joystick_info; 33 34 class _BJoystickTweaker { 35 36 public: 37 _BJoystickTweaker(); 38 _BJoystickTweaker(BJoystick &stick); 39 virtual ~_BJoystickTweaker(); 40 status_t SendIOCT(uint32 op); 41 status_t GetInfo(_joystick_info* info, const char * ref); 42 43 // BeOS R5's joystick pref need these 44 status_t save_config(const entry_ref * ref = NULL); 45 void scan_including_disabled(); 46 status_t get_info(); 47 48 private: 49 void _BuildFromJoystickDesc(char *string, _joystick_info* info); 50 status_t _ScanIncludingDisabled(const char* rootPath, BList *list, 51 BEntry *rootEntry = NULL); 52 53 void _EmpyList(BList *list); 54 BJoystick* fJoystick; 55 #if DEBUG 56 public: 57 static FILE *sLogFile; 58 #endif 59 }; 60