1139825Simp/*
290643Sbenno * Copyright 2008, Haiku, Inc.
390643Sbenno * Distributed under the terms of the MIT License.
490643Sbenno *
590643Sbenno * Authors:
690643Sbenno *		Fredrik Modeen
790643Sbenno */
890643Sbenno
990643Sbenno#include <joystick_driver.h>
1090643Sbenno
1190643Sbenno#include <Entry.h>
1290643Sbenno#include <List.h>
1390643Sbenno
1490643Sbenno
1590643Sbenno#if DEBUG
1690643Sbenno#include <stdio.h>
1790643Sbenno#endif
1890643Sbenno
1990643Sbenno#define DEVICE_BASE_PATH			"/dev/joystick/"
2090643Sbenno#define JOYSTICK_CONFIG_BASE_PATH	"/boot/home/config/settings/joysticks/"
2190643Sbenno	// TODO: this should use find_directory() instead and it should take
2290643Sbenno	// common/system into account as well
2390643Sbenno
2490643Sbennoclass BJoystick;
2590643Sbenno
2690643Sbennotypedef struct _joystick_info {
2790643Sbenno	joystick_module_info	module_info;
2890643Sbenno	bool					calibration_enable;
2990643Sbenno	bigtime_t				max_latency;
3090643Sbenno	BList					axis_names;
3190643Sbenno	BList					hat_names;
3290643Sbenno	BList					button_names;
3390643Sbenno} joystick_info;
3490643Sbenno
3590643Sbenno
36139825Simpclass _BJoystickTweaker {
3777957Sbennopublic:
3877957Sbenno						_BJoystickTweaker();
3977957Sbenno						_BJoystickTweaker(BJoystick &stick);
4077957Sbenno	virtual				~_BJoystickTweaker();
4177957Sbenno			status_t	SendIOCT(uint32 op);
4277957Sbenno			status_t	GetInfo(_joystick_info* info, const char *ref);
4377957Sbenno
4477957Sbenno			// BeOS R5's joystick pref need these
4577957Sbenno			status_t	save_config(const entry_ref *ref = NULL);
4677957Sbenno			void		scan_including_disabled();
4777957Sbenno			status_t	get_info();
4877957Sbenno
4977957Sbennoprivate:
5077957Sbenno			void		_BuildFromJoystickDesc(char *string,
5177957Sbenno							_joystick_info *info);
5277957Sbenno			status_t	_ScanIncludingDisabled(const char *rootPath,
5377957Sbenno							BList *list, BEntry *rootEntry = NULL);
5477957Sbenno
5577957Sbenno			void		_EmpyList(BList *list);
5677957Sbenno
5777957Sbenno			BJoystick *	fJoystick;
5877957Sbenno#if DEBUG
5977957Sbennopublic:
6077957Sbenno	static	FILE *		sLogFile;
6177957Sbenno#endif
6277957Sbenno};
6377957Sbenno