vfs: check userland buffers before reading them.
[haiku.git] / headers / private / device / JoystickTweaker.h
blob1051d216141547f8e9baaafbdc053565279ed179
1 /*
2 * Copyright 2008, Haiku, Inc.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Fredrik Modeen
7 */
9 #include <joystick_driver.h>
11 #include <Entry.h>
12 #include <List.h>
15 #if DEBUG
16 #include <stdio.h>
17 #endif
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
24 class BJoystick;
26 typedef 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;
36 class _BJoystickTweaker {
37 public:
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);
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();
49 private:
50 void _BuildFromJoystickDesc(char *string,
51 _joystick_info *info);
52 status_t _ScanIncludingDisabled(const char *rootPath,
53 BList *list, BEntry *rootEntry = NULL);
55 void _EmpyList(BList *list);
57 BJoystick * fJoystick;
58 #if DEBUG
59 public:
60 static FILE * sLogFile;
61 #endif