mirror of
https://review.haiku-os.org/haiku
synced 2025-02-12 00:28:19 +01:00
inside BJoystick. * Add joystick_module_info flag to communicate support for variably sized reads. * The variably sized data structure is set up to describe either the actual amount of data, when variably sized reads are supported by the driver, or it is set up so that it exactly matches the data layout of the extended_joystick structure. This allows us to support both as input data, while only needing to care about a single format inside BJoystick. Convenience pointers allow the data to be retrieved without additional overhead or extra logic. * Add some sanity checks and ensure some boundaries when dealing reading data from the variably sized structure (as there might not be any buttons, hats, axis at all now). * Ensure that the extended_joystick structure doesn't change in size due to padding by making it _PACKED (it wasn't padded though). This is still supposed to work exactly as before. However, it opens up the possibility to actually support arbitrary controllers with arbitrary axis, hat and button counts. It therefore allows to actually deliver what the BJoystick API was designed to handle all along. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41885 a95241bf-73f2-0310-859d-f6bbb57e9c96
26 lines
505 B
C
26 lines
505 B
C
/*
|
|
* Copyright 2011 Michael Lotz <mmlr@mlotz.ch>
|
|
* Distributed under the terms of the MIT license.
|
|
*/
|
|
#ifndef _JOYSTICK_PRIVATE_H
|
|
#define _JOYSTICK_PRIVATE_H
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
typedef struct _variable_joystick {
|
|
uint32 axis_count;
|
|
uint32 hat_count;
|
|
uint32 button_blocks;
|
|
|
|
// these pointers all point into the data section
|
|
bigtime_t * timestamp;
|
|
uint32 * buttons;
|
|
int16 * axes;
|
|
uint8 * hats;
|
|
|
|
size_t data_size;
|
|
uint8 * data;
|
|
} variable_joystick;
|
|
|
|
#endif // _JOYSTICK_PRIVATE_H
|