2008-08-03 22:29:21 +04:00
|
|
|
/*
|
2008-08-11 20:45:26 +04:00
|
|
|
* Copyright 2008, Haiku, Inc.
|
2008-08-03 22:29:21 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
2008-08-11 20:45:26 +04:00
|
|
|
* Fredrik Modeen
|
2008-08-03 22:29:21 +04:00
|
|
|
*/
|
2008-08-11 20:45:26 +04:00
|
|
|
|
2008-08-03 22:29:21 +04:00
|
|
|
#include "joystick_driver.h"
|
2008-08-11 20:45:26 +04:00
|
|
|
|
2008-08-03 22:29:21 +04:00
|
|
|
#include <List.h>
|
|
|
|
#include <Entry.h>
|
|
|
|
|
|
|
|
#define DEVICEPATH "/dev/joystick/"
|
|
|
|
#define JOYSTICKPATH "/boot/home/config/settings/joysticks/"
|
|
|
|
|
|
|
|
class BJoystick;
|
|
|
|
|
2008-10-23 12:18:48 +04:00
|
|
|
typedef struct _joystick_info {
|
|
|
|
char module_name[64];
|
|
|
|
char controller_name[64];
|
|
|
|
int16 num_axes;
|
|
|
|
int16 num_buttons;
|
|
|
|
int16 num_hats;
|
|
|
|
uint32 num_sticks;
|
|
|
|
bool calibration_enable;
|
|
|
|
bigtime_t max_latency;
|
|
|
|
BList name_axis;
|
|
|
|
BList name_hat;
|
|
|
|
BList name_button;
|
|
|
|
// BList name_
|
|
|
|
} joystick_info;
|
2008-08-03 22:29:21 +04:00
|
|
|
|
|
|
|
class _BJoystickTweaker {
|
|
|
|
|
|
|
|
public:
|
|
|
|
_BJoystickTweaker();
|
|
|
|
_BJoystickTweaker(BJoystick &stick);
|
2008-08-23 15:16:14 +04:00
|
|
|
virtual ~_BJoystickTweaker();
|
2008-08-03 22:29:21 +04:00
|
|
|
status_t SendIOCT(uint32 op);
|
2008-08-23 15:16:14 +04:00
|
|
|
status_t GetInfo(_joystick_info* info, const char * ref);
|
|
|
|
|
|
|
|
// BeOS R5's joystick pref need these
|
2008-08-03 22:29:21 +04:00
|
|
|
status_t save_config(const entry_ref * ref = NULL);
|
2008-08-23 15:16:14 +04:00
|
|
|
void scan_including_disabled();
|
2008-08-03 22:29:21 +04:00
|
|
|
status_t get_info();
|
2008-08-23 15:16:14 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
void _BuildFromJoystickDesc(char *string, _joystick_info* info);
|
|
|
|
status_t _ScanIncludingDisabled(const char* rootPath, BList *list,
|
|
|
|
BEntry *rootEntry = NULL);
|
|
|
|
|
|
|
|
void _EmpyList(BList *list);
|
|
|
|
BJoystick* fJoystick;
|
2008-08-11 20:45:26 +04:00
|
|
|
#if DEBUG
|
2008-08-03 22:29:21 +04:00
|
|
|
public:
|
|
|
|
static FILE *sLogFile;
|
2008-08-11 20:45:26 +04:00
|
|
|
#endif
|
2008-08-03 22:29:21 +04:00
|
|
|
};
|