Commit Graph

8 Commits

Author SHA1 Message Date
Augustin Cavalier f4b42b518a drivers: Deduplify joystick_driver.h.
Now there is only the one copy in headers/private/device.
2018-06-21 18:46:30 -04:00
Michael Lotz 97184c6965 Tiny comment cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42275 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-06-21 12:35:50 +00:00
Michael Lotz a4aa4541c1 * Make it a valid C header again.
* Cleanup of include grouping as pointed out by Axel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41899 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-06-03 23:31:05 +00:00
Michael Lotz 34f0d87a9d Add initialize[_to_extended_joystick]() methods to variable_joystick. With those
methods the members are populated, the flat data size is calcualted, the data
buffer is allocated and the convenience pointers are set up automatically. With
initialize() an arbitrary configuration can be created, with
initialize_to_extended_joystick() a configuration is created that exactly
matches the data structure of the extended_joystick struct.
Having them here makes it easy to use the structure from a driver as well
without the need to set up everything manually.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41888 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-06-03 20:54:05 +00:00
Michael Lotz 6e0cca2f96 * Remove the JoystickPrivate.h again and move the variable_joystick structure
into joystick_driver.h as it is convenient to have also on the driver side.
* Added comments explaining the data structure and use case of the structure.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41886 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-06-03 19:48:16 +00:00
Michael Lotz ab1763688f * Replace the fixed size extended_joystick structure with a variably sized one
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
2011-06-03 18:33:43 +00:00
Michael Lotz ef13dbda92 * 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
2011-05-31 02:05:39 +00:00
Fredrik Modeen c3c574689d and now the files
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26767 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-03 18:29:21 +00:00