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 <Entry.h>
12#include <List.h>
13
14
15#if DEBUG
16#include <stdio.h>
17#endif
18
19#define DEVICE_BASE_PATH			"/dev/joystick/"
20#define JOYSTICK_CONFIG_BASE_PATH	"/boot/home/config/settings/joysticks/"
21	// TODO: this should use find_directory() instead and it should take
22	// common/system into account as well
23
24class BJoystick;
25
26typedef struct _joystick_info {
27	joystick_module_info	module_info;
28	bool					calibration_enable;
29	bigtime_t				max_latency;
30	BList					axis_names;
31	BList					hat_names;
32	BList					button_names;
33} joystick_info;
34
35
36class _BJoystickTweaker {
37public:
38						_BJoystickTweaker();
39						_BJoystickTweaker(BJoystick &stick);
40	virtual				~_BJoystickTweaker();
41			status_t	SendIOCT(uint32 op);
42			status_t	GetInfo(_joystick_info* info, const char *ref);
43
44			// BeOS R5's joystick pref need these
45			status_t	save_config(const entry_ref *ref = NULL);
46			void		scan_including_disabled();
47			status_t	get_info();
48
49private:
50			void		_BuildFromJoystickDesc(char *string,
51							_joystick_info *info);
52			status_t	_ScanIncludingDisabled(const char *rootPath,
53							BList *list, BEntry *rootEntry = NULL);
54
55			void		_EmpyList(BList *list);
56
57			BJoystick *	fJoystick;
58#if DEBUG
59public:
60	static	FILE *		sLogFile;
61#endif
62};
63