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
|
|
|
|
2011-05-31 06:05:39 +04:00
|
|
|
#include <joystick_driver.h>
|
2008-08-11 20:45:26 +04:00
|
|
|
|
2008-08-03 22:29:21 +04:00
|
|
|
#include <Entry.h>
|
2011-06-02 16:42:18 +04:00
|
|
|
#include <List.h>
|
|
|
|
|
2008-08-03 22:29:21 +04:00
|
|
|
|
2009-09-13 05:30:38 +04:00
|
|
|
#if DEBUG
|
|
|
|
#include <stdio.h>
|
|
|
|
#endif
|
|
|
|
|
2011-06-02 16:42:18 +04:00
|
|
|
#define DEVICE_BASE_PATH "/dev/joystick/"
|
|
|
|
#define JOYSTICK_CONFIG_BASE_PATH "/boot/home/config/settings/joysticks/"
|
|
|
|
// TODO: this should use find_directory() instead and it should take
|
|
|
|
// common/system into account as well
|
2008-08-03 22:29:21 +04:00
|
|
|
|
|
|
|
class BJoystick;
|
|
|
|
|
2008-10-23 12:18:48 +04:00
|
|
|
typedef struct _joystick_info {
|
2011-05-31 06:05:39 +04:00
|
|
|
joystick_module_info module_info;
|
|
|
|
bool calibration_enable;
|
|
|
|
bigtime_t max_latency;
|
|
|
|
BList axis_names;
|
|
|
|
BList hat_names;
|
|
|
|
BList button_names;
|
2008-10-23 12:18:48 +04:00
|
|
|
} joystick_info;
|
2008-08-03 22:29:21 +04:00
|
|
|
|
|
|
|
|
2011-06-02 16:42:18 +04:00
|
|
|
class _BJoystickTweaker {
|
2008-08-03 22:29:21 +04:00
|
|
|
public:
|
2011-06-02 16:42:18 +04:00
|
|
|
_BJoystickTweaker();
|
|
|
|
_BJoystickTweaker(BJoystick &stick);
|
|
|
|
virtual ~_BJoystickTweaker();
|
|
|
|
status_t SendIOCT(uint32 op);
|
|
|
|
status_t GetInfo(_joystick_info* info, const char *ref);
|
2011-05-31 06:05:39 +04:00
|
|
|
|
2011-06-02 16:42:18 +04:00
|
|
|
// BeOS R5's joystick pref need these
|
|
|
|
status_t save_config(const entry_ref *ref = NULL);
|
|
|
|
void scan_including_disabled();
|
|
|
|
status_t get_info();
|
2011-05-31 06:05:39 +04:00
|
|
|
|
2008-08-23 15:16:14 +04:00
|
|
|
private:
|
2011-06-02 16:42:18 +04:00
|
|
|
void _BuildFromJoystickDesc(char *string,
|
|
|
|
_joystick_info *info);
|
|
|
|
status_t _ScanIncludingDisabled(const char *rootPath,
|
|
|
|
BList *list, BEntry *rootEntry = NULL);
|
|
|
|
|
|
|
|
void _EmpyList(BList *list);
|
2011-05-31 06:05:39 +04:00
|
|
|
|
2011-06-02 16:42:18 +04:00
|
|
|
BJoystick * fJoystick;
|
2008-08-11 20:45:26 +04:00
|
|
|
#if DEBUG
|
2008-08-03 22:29:21 +04:00
|
|
|
public:
|
2011-06-02 16:42:18 +04:00
|
|
|
static FILE * sLogFile;
|
2008-08-11 20:45:26 +04:00
|
|
|
#endif
|
2008-08-03 22:29:21 +04:00
|
|
|
};
|