Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
0baabde7
Commit
0baabde7
authored
May 31, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Jun 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebus.sys: Use macros to define HID reports.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
36f18607
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
277 additions
and
97 deletions
+277
-97
bus_sdl.c
dlls/winebus.sys/bus_sdl.c
+58
-54
bus_udev.c
dlls/winebus.sys/bus_udev.c
+11
-7
controller.h
dlls/winebus.sys/controller.h
+40
-36
pop_hid_macros.h
dlls/winebus.sys/pop_hid_macros.h
+83
-0
psh_hid_macros.h
dlls/winebus.sys/psh_hid_macros.h
+85
-0
No files found.
dlls/winebus.sys/bus_sdl.c
View file @
0baabde7
...
@@ -138,58 +138,60 @@ static inline struct platform_private *impl_from_DEVICE_OBJECT(DEVICE_OBJECT *de
...
@@ -138,58 +138,60 @@ static inline struct platform_private *impl_from_DEVICE_OBJECT(DEVICE_OBJECT *de
return
(
struct
platform_private
*
)
get_platform_private
(
device
);
return
(
struct
platform_private
*
)
get_platform_private
(
device
);
}
}
#include "psh_hid_macros.h"
static
const
BYTE
REPORT_AXIS_TAIL
[]
=
{
static
const
BYTE
REPORT_AXIS_TAIL
[]
=
{
0x17
,
0x00
,
0x00
,
0x00
,
0x00
,
/* LOGICAL_MINIMUM (0) */
LOGICAL_MINIMUM
(
4
,
0x00000000
),
0x27
,
0xff
,
0xff
,
0x00
,
0x00
,
/* LOGICAL_MAXIMUM (65535) */
LOGICAL_MAXIMUM
(
4
,
0x0000ffff
),
0x37
,
0x00
,
0x00
,
0x00
,
0x00
,
/* PHYSICAL_MINIMUM (0) */
PHYSICAL_MINIMUM
(
4
,
0x00000000
),
0x47
,
0xff
,
0xff
,
0x00
,
0x00
,
/* PHYSICAL_MAXIMUM (65535) */
PHYSICAL_MAXIMUM
(
4
,
0x0000ffff
),
0x75
,
0x10
,
/* REPORT_SIZE (16) */
REPORT_SIZE
(
1
,
16
),
0x95
,
0x00
,
/* REPORT_COUNT (?) */
REPORT_COUNT
(
1
,
/* placeholder */
0
),
0x81
,
0x02
,
/* INPUT (Data,Var,Abs) */
INPUT
(
1
,
Data
|
Var
|
Abs
),
};
};
#define IDX_ABS_AXIS_COUNT 23
#define IDX_ABS_AXIS_COUNT 23
#define CONTROLLER_NUM_BUTTONS 11
#define CONTROLLER_NUM_BUTTONS 11
static
const
BYTE
CONTROLLER_BUTTONS
[]
=
{
static
const
BYTE
CONTROLLER_BUTTONS
[]
=
{
0x05
,
0x09
,
/* USAGE_PAGE (Button) */
USAGE_PAGE
(
1
,
HID_USAGE_PAGE_BUTTON
),
0x19
,
0x01
,
/* USAGE_MINIMUM (Button 1) */
USAGE_MINIMUM
(
1
,
1
),
0x29
,
CONTROLLER_NUM_BUTTONS
,
/* USAGE_MAXIMUM (Button 11) */
USAGE_MAXIMUM
(
1
,
CONTROLLER_NUM_BUTTONS
),
0x15
,
0x00
,
/* LOGICAL_MINIMUM (0) */
LOGICAL_MINIMUM
(
1
,
0
),
0x25
,
0x01
,
/* LOGICAL_MAXIMUM (1) */
LOGICAL_MAXIMUM
(
1
,
1
),
0x35
,
0x00
,
/* LOGICAL_MINIMUM (0) */
PHYSICAL_MINIMUM
(
1
,
0
),
0x45
,
0x01
,
/* LOGICAL_MAXIMUM (1) */
PHYSICAL_MAXIMUM
(
1
,
1
),
0x95
,
CONTROLLER_NUM_BUTTONS
,
/* REPORT_COUNT (11) */
REPORT_COUNT
(
1
,
CONTROLLER_NUM_BUTTONS
),
0x75
,
0x01
,
/* REPORT_SIZE (1) */
REPORT_SIZE
(
1
,
1
),
0x81
,
0x02
,
/* INPUT (Data,Var,Abs) */
INPUT
(
1
,
Data
|
Var
|
Abs
),
};
};
static
const
BYTE
CONTROLLER_AXIS
[]
=
{
static
const
BYTE
CONTROLLER_AXIS
[]
=
{
0x05
,
0x01
,
/* USAGE_PAGE (Generic Desktop) */
USAGE_PAGE
(
1
,
HID_USAGE_PAGE_GENERIC
),
0x09
,
0x30
,
/* USAGE (X) */
USAGE
(
1
,
HID_USAGE_GENERIC_X
),
0x09
,
0x31
,
/* USAGE (Y) */
USAGE
(
1
,
HID_USAGE_GENERIC_Y
),
0x09
,
0x33
,
/* USAGE (RX) */
USAGE
(
1
,
HID_USAGE_GENERIC_RX
),
0x09
,
0x34
,
/* USAGE (RY) */
USAGE
(
1
,
HID_USAGE_GENERIC_RY
),
0x17
,
0x00
,
0x00
,
0x00
,
0x00
,
/* LOGICAL_MINIMUM (0) */
LOGICAL_MINIMUM
(
4
,
0x00000000
),
0x27
,
0xff
,
0xff
,
0x00
,
0x00
,
/* LOGICAL_MAXIMUM (65535) */
LOGICAL_MAXIMUM
(
4
,
0x0000ffff
),
0x37
,
0x00
,
0x00
,
0x00
,
0x00
,
/* PHYSICAL_MINIMUM (0) */
PHYSICAL_MINIMUM
(
4
,
0x00000000
),
0x47
,
0xff
,
0xff
,
0x00
,
0x00
,
/* PHYSICAL_MAXIMUM (65535) */
PHYSICAL_MAXIMUM
(
4
,
0x0000ffff
),
0x75
,
0x10
,
/* REPORT_SIZE (16) */
REPORT_SIZE
(
1
,
16
),
0x95
,
0x04
,
/* REPORT_COUNT (4) */
REPORT_COUNT
(
1
,
4
),
0x81
,
0x02
,
/* INPUT (Data,Var,Abs) */
INPUT
(
1
,
Data
|
Var
|
Abs
),
};
};
static
const
BYTE
CONTROLLER_TRIGGERS
[]
=
{
static
const
BYTE
CONTROLLER_TRIGGERS
[]
=
{
0x05
,
0x01
,
/* USAGE_PAGE (Generic Desktop) */
USAGE_PAGE
(
1
,
HID_USAGE_PAGE_GENERIC
),
0x09
,
0x32
,
/* USAGE (Z) */
USAGE
(
1
,
HID_USAGE_GENERIC_Z
),
0x09
,
0x35
,
/* USAGE (RZ) */
USAGE
(
1
,
HID_USAGE_GENERIC_RZ
),
0x16
,
0x00
,
0x00
,
/* LOGICAL_MINIMUM (0) */
LOGICAL_MINIMUM
(
2
,
0x0000
),
0x26
,
0xff
,
0x7f
,
/* LOGICAL_MAXIMUM (32767) */
LOGICAL_MAXIMUM
(
2
,
0x7fff
),
0x36
,
0x00
,
0x00
,
/* PHYSICAL_MINIMUM (0) */
PHYSICAL_MINIMUM
(
2
,
0x0000
),
0x46
,
0xff
,
0x7f
,
/* PHYSICAL_MAXIMUM (32767) */
PHYSICAL_MAXIMUM
(
2
,
0x7fff
),
0x75
,
0x10
,
/* REPORT_SIZE (16) */
REPORT_SIZE
(
1
,
16
),
0x95
,
0x02
,
/* REPORT_COUNT (2) */
REPORT_COUNT
(
1
,
2
),
0x81
,
0x02
,
/* INPUT (Data,Var,Abs) */
INPUT
(
1
,
Data
|
Var
|
Abs
),
};
};
#define CONTROLLER_NUM_AXES 6
#define CONTROLLER_NUM_AXES 6
...
@@ -197,26 +199,28 @@ static const BYTE CONTROLLER_TRIGGERS [] = {
...
@@ -197,26 +199,28 @@ static const BYTE CONTROLLER_TRIGGERS [] = {
#define CONTROLLER_NUM_HATSWITCHES 1
#define CONTROLLER_NUM_HATSWITCHES 1
static
const
BYTE
HAPTIC_RUMBLE
[]
=
{
static
const
BYTE
HAPTIC_RUMBLE
[]
=
{
0x06
,
0x00
,
0xff
,
/* USAGE PAGE (vendor-defined) */
USAGE_PAGE
(
2
,
HID_USAGE_PAGE_VENDOR_DEFINED_BEGIN
),
0x09
,
0x01
,
/* USAGE (1) */
USAGE
(
1
,
0x01
),
/* padding */
/* padding */
0x95
,
0x02
,
/* REPORT_COUNT (2) */
REPORT_COUNT
(
1
,
0x02
),
0x75
,
0x08
,
/* REPORT_SIZE (8) */
REPORT_SIZE
(
1
,
0x08
),
0x91
,
0x02
,
/* OUTPUT (Data,Var,Abs) */
OUTPUT
(
1
,
Data
|
Var
|
Abs
),
/* actuators */
/* actuators */
0x15
,
0x00
,
/* LOGICAL MINIMUM (0) */
LOGICAL_MINIMUM
(
1
,
0x00
),
0x25
,
0xff
,
/* LOGICAL MAXIMUM (255) */
LOGICAL_MAXIMUM
(
1
,
0xff
),
0x35
,
0x00
,
/* PHYSICAL MINIMUM (0) */
PHYSICAL_MINIMUM
(
1
,
0x00
),
0x45
,
0xff
,
/* PHYSICAL MAXIMUM (255) */
PHYSICAL_MAXIMUM
(
1
,
0xff
),
0x75
,
0x08
,
/* REPORT_SIZE (8) */
REPORT_SIZE
(
1
,
0x08
),
0x95
,
0x02
,
/* REPORT_COUNT (2) */
REPORT_COUNT
(
1
,
0x02
),
0x91
,
0x02
,
/* OUTPUT (Data,Var,Abs) */
OUTPUT
(
1
,
Data
|
Var
|
Abs
),
/* padding */
/* padding */
0x95
,
0x02
,
/* REPORT_COUNT (3) */
REPORT_COUNT
(
1
,
0x02
),
0x75
,
0x08
,
/* REPORT_SIZE (8) */
REPORT_SIZE
(
1
,
0x08
),
0x91
,
0x02
,
/* OUTPUT (Data,Var,Abs) */
OUTPUT
(
1
,
Data
|
Var
|
Abs
),
};
};
#include "pop_hid_macros.h"
static
BYTE
*
add_axis_block
(
BYTE
*
report_ptr
,
BYTE
count
,
BYTE
page
,
const
BYTE
*
usages
,
BOOL
absolute
)
static
BYTE
*
add_axis_block
(
BYTE
*
report_ptr
,
BYTE
count
,
BYTE
page
,
const
BYTE
*
usages
,
BOOL
absolute
)
{
{
int
i
;
int
i
;
...
...
dlls/winebus.sys/bus_udev.c
View file @
0baabde7
...
@@ -114,14 +114,16 @@ static inline struct platform_private *impl_from_DEVICE_OBJECT(DEVICE_OBJECT *de
...
@@ -114,14 +114,16 @@ static inline struct platform_private *impl_from_DEVICE_OBJECT(DEVICE_OBJECT *de
#ifdef HAS_PROPER_INPUT_HEADER
#ifdef HAS_PROPER_INPUT_HEADER
#include "psh_hid_macros.h"
static
const
BYTE
REPORT_ABS_AXIS_TAIL
[]
=
{
static
const
BYTE
REPORT_ABS_AXIS_TAIL
[]
=
{
0x17
,
0x00
,
0x00
,
0x00
,
0x00
,
/* LOGICAL_MINIMUM (0) */
LOGICAL_MINIMUM
(
4
,
/* placeholder */
0x00000000
),
0x27
,
0xff
,
0x00
,
0x00
,
0x00
,
/* LOGICAL_MAXIMUM (0xff) */
LOGICAL_MAXIMUM
(
4
,
/* placeholder */
0x000000ff
),
0x37
,
0x00
,
0x00
,
0x00
,
0x00
,
/* PHYSICAL_MINIMUM (0) */
PHYSICAL_MINIMUM
(
4
,
/* placeholder */
0x00000000
),
0x47
,
0xff
,
0x00
,
0x00
,
0x00
,
/* PHYSICAL_MAXIMUM (256) */
PHYSICAL_MAXIMUM
(
4
,
/* placeholder */
0x000000ff
),
0x75
,
0x20
,
/* REPORT_SIZE (32) */
REPORT_SIZE
(
1
,
32
),
0x95
,
0x00
,
/* REPORT_COUNT (2) */
REPORT_COUNT
(
1
,
/* placeholder */
0
),
0x81
,
0x02
,
/* INPUT (Data,Var,Abs) */
INPUT
(
1
,
Data
|
Var
|
Abs
),
};
};
#define IDX_ABS_LOG_MINIMUM 1
#define IDX_ABS_LOG_MINIMUM 1
#define IDX_ABS_LOG_MAXIMUM 6
#define IDX_ABS_LOG_MAXIMUM 6
...
@@ -129,6 +131,8 @@ static const BYTE REPORT_ABS_AXIS_TAIL[] = {
...
@@ -129,6 +131,8 @@ static const BYTE REPORT_ABS_AXIS_TAIL[] = {
#define IDX_ABS_PHY_MAXIMUM 16
#define IDX_ABS_PHY_MAXIMUM 16
#define IDX_ABS_AXIS_COUNT 23
#define IDX_ABS_AXIS_COUNT 23
#include "pop_hid_macros.h"
static
const
BYTE
ABS_TO_HID_MAP
[][
2
]
=
{
static
const
BYTE
ABS_TO_HID_MAP
[][
2
]
=
{
{
HID_USAGE_PAGE_GENERIC
,
HID_USAGE_GENERIC_X
},
/*ABS_X*/
{
HID_USAGE_PAGE_GENERIC
,
HID_USAGE_GENERIC_X
},
/*ABS_X*/
{
HID_USAGE_PAGE_GENERIC
,
HID_USAGE_GENERIC_Y
},
/*ABS_Y*/
{
HID_USAGE_PAGE_GENERIC
,
HID_USAGE_GENERIC_Y
},
/*ABS_Y*/
...
...
dlls/winebus.sys/controller.h
View file @
0baabde7
...
@@ -20,76 +20,80 @@
...
@@ -20,76 +20,80 @@
/* Blocks of data for building HID device descriptions */
/* Blocks of data for building HID device descriptions */
#include "psh_hid_macros.h"
static
const
BYTE
REPORT_HEADER
[]
=
{
static
const
BYTE
REPORT_HEADER
[]
=
{
0x05
,
0x01
,
/* USAGE_PAGE (Generic Desktop) */
USAGE_PAGE
(
1
,
/* placeholder */
HID_USAGE_PAGE_GENERIC
),
0x09
,
0x00
,
/* USAGE (??) */
USAGE
(
1
,
0
),
0xa1
,
0x01
,
/* COLLECTION (Application) */
COLLECTION
(
1
,
Application
),
0x09
,
0x01
,
/* USAGE () */
USAGE
(
1
,
/* placeholder */
HID_USAGE_GENERIC_POINTER
),
0xa1
,
0x00
,
/* COLLECTION (Physical) */
COLLECTION
(
1
,
Physical
),
};
};
#define IDX_HEADER_PAGE 1
#define IDX_HEADER_PAGE 1
#define IDX_HEADER_USAGE 3
#define IDX_HEADER_USAGE 3
static
const
BYTE
REPORT_BUTTONS
[]
=
{
static
const
BYTE
REPORT_BUTTONS
[]
=
{
0x05
,
0x09
,
/* USAGE_PAGE (Button) */
USAGE_PAGE
(
1
,
HID_USAGE_PAGE_BUTTON
),
0x19
,
0x01
,
/* USAGE_MINIMUM (Button 1) */
USAGE_MINIMUM
(
1
,
/* placeholder */
1
),
0x29
,
0x03
,
/* USAGE_MAXIMUM (Button 3) */
USAGE_MAXIMUM
(
1
,
/* placeholder */
3
),
0x15
,
0x00
,
/* LOGICAL_MINIMUM (0) */
LOGICAL_MINIMUM
(
1
,
0
),
0x25
,
0x01
,
/* LOGICAL_MAXIMUM (1) */
LOGICAL_MAXIMUM
(
1
,
1
),
0x35
,
0x00
,
/* PHYSICAL_MINIMUM (0) */
PHYSICAL_MINIMUM
(
1
,
0
),
0x45
,
0x01
,
/* PHYSICAL_MAXIMUM (1) */
PHYSICAL_MAXIMUM
(
1
,
1
),
0x95
,
0x03
,
/* REPORT_COUNT (3) */
REPORT_COUNT
(
1
,
/* placeholder */
3
),
0x75
,
0x01
,
/* REPORT_SIZE (1) */
REPORT_SIZE
(
1
,
1
),
0x81
,
0x02
,
/* INPUT (Data,Var,Abs) */
INPUT
(
1
,
Data
|
Var
|
Abs
),
};
};
#define IDX_BUTTON_MIN_USAGE 3
#define IDX_BUTTON_MIN_USAGE 3
#define IDX_BUTTON_MAX_USAGE 5
#define IDX_BUTTON_MAX_USAGE 5
#define IDX_BUTTON_COUNT 15
#define IDX_BUTTON_COUNT 15
static
const
BYTE
REPORT_PADDING
[]
=
{
static
const
BYTE
REPORT_PADDING
[]
=
{
0x95
,
0x03
,
/* REPORT_COUNT (3) */
REPORT_COUNT
(
1
,
/* placeholder */
3
),
0x75
,
0x01
,
/* REPORT_SIZE (1) */
REPORT_SIZE
(
1
,
1
),
0x81
,
0x03
,
/* INPUT (Cnst,Var,Abs) */
INPUT
(
1
,
Cnst
|
Var
|
Abs
),
};
};
#define IDX_PADDING_BIT_COUNT 1
#define IDX_PADDING_BIT_COUNT 1
static
const
BYTE
REPORT_AXIS_HEADER
[]
=
{
static
const
BYTE
REPORT_AXIS_HEADER
[]
=
{
0x05
,
0x01
,
/* USAGE_PAGE (Generic Desktop) */
USAGE_PAGE
(
1
,
/* placeholder */
HID_USAGE_PAGE_GENERIC
),
};
};
#define IDX_AXIS_PAGE 1
#define IDX_AXIS_PAGE 1
static
const
BYTE
REPORT_AXIS_USAGE
[]
=
{
static
const
BYTE
REPORT_AXIS_USAGE
[]
=
{
0x09
,
0x30
,
/* USAGE (X) */
USAGE
(
1
,
/* placeholder */
HID_USAGE_GENERIC_X
),
};
};
#define IDX_AXIS_USAGE 1
#define IDX_AXIS_USAGE 1
static
const
BYTE
REPORT_REL_AXIS_TAIL
[]
=
{
static
const
BYTE
REPORT_REL_AXIS_TAIL
[]
=
{
0x15
,
0x81
,
/* LOGICAL_MINIMUM (0) */
LOGICAL_MINIMUM
(
1
,
0x81
),
0x25
,
0x7f
,
/* LOGICAL_MAXIMUM (0xffff) */
LOGICAL_MAXIMUM
(
1
,
0x7f
),
0x75
,
0x08
,
/* REPORT_SIZE (16) */
REPORT_SIZE
(
1
,
8
),
0x95
,
0x02
,
/* REPORT_COUNT (2) */
REPORT_COUNT
(
1
,
/* placeholder */
2
),
0x81
,
0x06
,
/* INPUT (Data,Var,Rel) */
INPUT
(
1
,
Data
|
Var
|
Rel
),
};
};
#define IDX_REL_AXIS_COUNT 7
#define IDX_REL_AXIS_COUNT 7
static
const
BYTE
REPORT_HATSWITCH
[]
=
{
static
const
BYTE
REPORT_HATSWITCH
[]
=
{
0x05
,
0x01
,
/* USAGE_PAGE (Generic Desktop) */
USAGE_PAGE
(
1
,
HID_USAGE_PAGE_GENERIC
),
0x09
,
0x39
,
/* USAGE (Hatswitch) */
USAGE
(
1
,
HID_USAGE_GENERIC_HATSWITCH
),
0x15
,
0x01
,
/* LOGICAL_MINIMUM (1) */
LOGICAL_MINIMUM
(
1
,
1
),
0x25
,
0x08
,
/* LOGICAL_MAXIMUM (0x08) */
LOGICAL_MAXIMUM
(
1
,
8
),
0x35
,
0x00
,
/* PHYSICAL_MINIMUM (0) */
PHYSICAL_MINIMUM
(
1
,
0
),
0x45
,
0x08
,
/* PHYSICAL_MAXIMUM (8) */
PHYSICAL_MAXIMUM
(
1
,
8
),
0x75
,
0x04
,
/* REPORT_SIZE (4) */
REPORT_SIZE
(
1
,
4
),
0x95
,
0x01
,
/* REPORT_COUNT (1) */
REPORT_COUNT
(
1
,
/* placeholder */
1
),
0x81
,
0x02
,
/* INPUT (Data,Var,Abs) */
INPUT
(
1
,
Data
|
Var
|
Abs
),
};
};
#define IDX_HATSWITCH_COUNT 15
#define IDX_HATSWITCH_COUNT 15
static
const
BYTE
REPORT_TAIL
[]
=
{
static
const
BYTE
REPORT_TAIL
[]
=
{
0xc0
,
/* END_COLLECTION */
END_COLLECTION
,
0xc0
/* END_COLLECTION */
END_COLLECTION
,
};
};
#include "pop_hid_macros.h"
static
inline
BYTE
*
add_button_block
(
BYTE
*
report_ptr
,
BYTE
usage_min
,
BYTE
usage_max
)
static
inline
BYTE
*
add_button_block
(
BYTE
*
report_ptr
,
BYTE
usage_min
,
BYTE
usage_max
)
{
{
memcpy
(
report_ptr
,
REPORT_BUTTONS
,
sizeof
(
REPORT_BUTTONS
));
memcpy
(
report_ptr
,
REPORT_BUTTONS
,
sizeof
(
REPORT_BUTTONS
));
...
...
dlls/winebus.sys/pop_hid_macros.h
0 → 100644
View file @
0baabde7
/*
* HID report helper macros.
*
* Copyright 2021 Rémi Bernon for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#undef Data
#undef Cnst
#undef Array
#undef Var
#undef Abs
#undef Rel
#undef NoWrap
#undef Wrap
#undef NonLin
#undef Lin
#undef NoPref
#undef Pref
#undef NoNull
#undef Null
#undef NonVol
#undef Vol
#undef Bits
#undef Buff
#undef Physical
#undef Application
#undef Logical
#undef Report
#undef NamedArray
#undef UsageSwitch
#undef UsageModifier
#undef SHORT_ITEM_0
#undef SHORT_ITEM_1
#undef SHORT_ITEM_2
#undef SHORT_ITEM_4
#undef LONG_ITEM
#undef INPUT
#undef OUTPUT
#undef FEATURE
#undef COLLECTION
#undef END_COLLECTION
#undef USAGE_PAGE
#undef LOGICAL_MINIMUM
#undef LOGICAL_MAXIMUM
#undef PHYSICAL_MINIMUM
#undef PHYSICAL_MAXIMUM
#undef UNIT_EXPONENT
#undef UNIT
#undef REPORT_SIZE
#undef REPORT_ID
#undef REPORT_COUNT
#undef PUSH
#undef POP
#undef USAGE
#undef USAGE_MINIMUM
#undef USAGE_MAXIMUM
#undef DESIGNATOR_INDEX
#undef DESIGNATOR_MINIMUM
#undef DESIGNATOR_MAXIMUM
#undef STRING_INDEX
#undef STRING_MINIMUM
#undef STRING_MAXIMUM
#undef DELIMITER
dlls/winebus.sys/psh_hid_macros.h
0 → 100644
View file @
0baabde7
/*
* HID report helper macros.
*
* Copyright 2021 Rémi Bernon for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <hidusage.h>
#define Data 0
#define Cnst 0x01
#define Ary 0
#define Var 0x02
#define Abs 0
#define Rel 0x04
#define NoWrap 0
#define Wrap 0x08
#define NonLin 0
#define Lin 0x10
#define NoPref 0
#define Pref 0x20
#define NoNull 0
#define Null 0x40
#define NonVol 0
#define Vol 0x80
#define Bits 0
#define Buff 0x100
#define Physical 0x00
#define Application 0x01
#define Logical 0x02
#define Report 0x03
#define NamedArray 0x04
#define UsageSwitch 0x05
#define UsageModifier 0x06
#define SHORT_ITEM_0(tag,type) (((tag)<<4)|((type)<<2)|0)
#define SHORT_ITEM_1(tag,type,data) (((tag)<<4)|((type)<<2)|1),((data)&0xff)
#define SHORT_ITEM_2(tag,type,data) (((tag)<<4)|((type)<<2)|2),((data)&0xff),(((data)>>8)&0xff)
#define SHORT_ITEM_4(tag,type,data) (((tag)<<4)|((type)<<2)|3),((data)&0xff),(((data)>>8)&0xff),(((data)>>16)&0xff),(((data)>>24)&0xff)
#define LONG_ITEM(tag,size) SHORT_ITEM_2(0xf,0x3,((tag)<<8)|(size))
#define INPUT(n,data) SHORT_ITEM_##n(0x8,0,data)
#define OUTPUT(n,data) SHORT_ITEM_##n(0x9,0,data)
#define FEATURE(n,data) SHORT_ITEM_##n(0xb,0,data)
#define COLLECTION(n,data) SHORT_ITEM_##n(0xa,0,data)
#define END_COLLECTION SHORT_ITEM_0(0xc,0)
#define USAGE_PAGE(n,data) SHORT_ITEM_##n(0x0,1,data)
#define LOGICAL_MINIMUM(n,data) SHORT_ITEM_##n(0x1,1,data)
#define LOGICAL_MAXIMUM(n,data) SHORT_ITEM_##n(0x2,1,data)
#define PHYSICAL_MINIMUM(n,data) SHORT_ITEM_##n(0x3,1,data)
#define PHYSICAL_MAXIMUM(n,data) SHORT_ITEM_##n(0x4,1,data)
#define UNIT_EXPONENT(n,data) SHORT_ITEM_##n(0x5,1,data)
#define UNIT(n,data) SHORT_ITEM_##n(0x6,1,data)
#define REPORT_SIZE(n,data) SHORT_ITEM_##n(0x7,1,data)
#define REPORT_ID(n,data) SHORT_ITEM_##n(0x8,1,data)
#define REPORT_COUNT(n,data) SHORT_ITEM_##n(0x9,1,data)
#define PUSH(n,data) SHORT_ITEM_##n(0xa,1,data)
#define POP(n,data) SHORT_ITEM_##n(0xb,1,data)
#define USAGE(n,data) SHORT_ITEM_##n(0x0,2,data)
#define USAGE_MINIMUM(n,data) SHORT_ITEM_##n(0x1,2,data)
#define USAGE_MAXIMUM(n,data) SHORT_ITEM_##n(0x2,2,data)
#define DESIGNATOR_INDEX(n,data) SHORT_ITEM_##n(0x3,2,data)
#define DESIGNATOR_MINIMUM(n,data) SHORT_ITEM_##n(0x4,2,data)
#define DESIGNATOR_MAXIMUM(n,data) SHORT_ITEM_##n(0x5,2,data)
#define STRING_INDEX(n,data) SHORT_ITEM_##n(0x6,2,data)
#define STRING_MINIMUM(n,data) SHORT_ITEM_##n(0x7,2,data)
#define STRING_MAXIMUM(n,data) SHORT_ITEM_##n(0x8,2,data)
#define DELIMITER(n,data) SHORT_ITEM_##n(0x9,2,data)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment