* Actually implement the relevant parts of BJoystick, i.e. reading the joystick

info and values. Inspired by and in parts based on the patch by caz_haiku in
  ticket #7429 (though rewritten completely due to the other changes). Thanks
  for the pointers!
* Clean up the mixup of internal joystick info and the one from
  joystick_driver.h so that BJoystick and the drivers talk about the same
  structures.
* Extensive coding style cleanup, simplifications, NULL checks, early returns,
  std::nothrow allocations, include sorting, argument naming, ... that kind of
  stuff.
* Added some TODO notes for remaining stuff.
* Automatic (and manual) whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41849 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2011-05-31 02:05:39 +00:00
parent 331a968c65
commit ef13dbda92
5 changed files with 299 additions and 131 deletions
+2 -2
View File
@@ -87,10 +87,10 @@ friend class _BJoystickTweaker;
bool fBeBoxMode;
bool fReservedBool;
int ffd;
int fFD;
BList* fDevices;
_joystick_info* fJoystickInfo;
char* fDevName;
BList* fExtendedJoystick;
uint32 _reserved_Joystick_[10];
};
+12 -18
View File
@@ -6,7 +6,7 @@
* Fredrik Modeen
*/
#include "joystick_driver.h"
#include <joystick_driver.h>
#include <List.h>
#include <Entry.h>
@@ -21,18 +21,12 @@
class BJoystick;
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_module_info module_info;
bool calibration_enable;
bigtime_t max_latency;
BList axis_names;
BList hat_names;
BList button_names;
} joystick_info;
class _BJoystickTweaker {
@@ -43,18 +37,18 @@ public:
virtual ~_BJoystickTweaker();
status_t SendIOCT(uint32 op);
status_t GetInfo(_joystick_info* info, const char * ref);
// BeOS R5's joystick pref need these
status_t save_config(const entry_ref * ref = NULL);
void scan_including_disabled();
status_t get_info();
private:
void _BuildFromJoystickDesc(char *string, _joystick_info* info);
status_t _ScanIncludingDisabled(const char* rootPath, BList *list,
status_t _ScanIncludingDisabled(const char* rootPath, BList *list,
BEntry *rootEntry = NULL);
void _EmpyList(BList *list);
void _EmpyList(BList *list);
BJoystick* fJoystick;
#if DEBUG
public:
+1 -1
View File
@@ -79,7 +79,7 @@ typedef struct _joystick_module {
int _reserved_;
} joystick_module;
/** Doing force feedback means writing an extended_joystick to the device with force values.
/** Doing force feedback means writing an extended_joystick to the device with force values.
The "timestamp" should be the duration of the feedback. Successive writes will be queued
by the device module. */
enum { /* Joystick driver ioctl() opcodes */