/usr/include/hidrd/item/global.h is in libhidrd0-dev 0.2.0-11.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | /** @file
* @brief HID report descriptor - global item
*
* Copyright (C) 2009 Nikolai Kondrashov
*
* This file is part of hidrd.
*
* Hidrd is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Hidrd 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with hidrd; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @author Nikolai Kondrashov <spbnick@gmail.com>
*
* @(#) $Id: global.h 75 2009-12-24 17:36:18Z spb_nick $
*/
#ifndef __HIDRD_ITEM_GLOBAL_H__
#define __HIDRD_ITEM_GLOBAL_H__
#include "hidrd/item/short.h"
#ifdef __cplusplus
extern "C" {
#endif
#define HIDRD_ITEM_GLOBAL_TAG_MIN HIDRD_ITEM_SHORT_TAG_MIN
typedef enum hidrd_item_global_tag {
HIDRD_ITEM_GLOBAL_TAG_USAGE_PAGE = HIDRD_ITEM_GLOBAL_TAG_MIN,
HIDRD_ITEM_GLOBAL_TAG_LOGICAL_MINIMUM,
HIDRD_ITEM_GLOBAL_TAG_LOGICAL_MAXIMUM,
HIDRD_ITEM_GLOBAL_TAG_PHYSICAL_MINIMUM,
HIDRD_ITEM_GLOBAL_TAG_PHYSICAL_MAXIMUM,
HIDRD_ITEM_GLOBAL_TAG_UNIT_EXPONENT,
HIDRD_ITEM_GLOBAL_TAG_UNIT,
HIDRD_ITEM_GLOBAL_TAG_REPORT_SIZE,
HIDRD_ITEM_GLOBAL_TAG_REPORT_ID,
HIDRD_ITEM_GLOBAL_TAG_REPORT_COUNT,
HIDRD_ITEM_GLOBAL_TAG_PUSH,
HIDRD_ITEM_GLOBAL_TAG_POP
} hidrd_item_global_tag;
#define HIDRD_ITEM_GLOBAL_TAG_MAX HIDRD_ITEM_SHORT_TAG_MAX
#define HIDRD_ITEM_GLOBAL_TAG_KNOWN_MAX HIDRD_ITEM_GLOBAL_TAG_POP
#define HIDRD_ITEM_GLOBAL_TAG_RESERVED_MIN \
(HIDRD_ITEM_GLOBAL_TAG_KNOWN_MAX + 1)
#define HIDRD_ITEM_GLOBAL_TAG_RESERVED_MAX \
HIDRD_ITEM_GLOBAL_TAG_MAX
static inline bool
hidrd_item_global_tag_valid(hidrd_item_global_tag tag)
{
return (tag <= HIDRD_ITEM_GLOBAL_TAG_MAX);
}
static inline bool
hidrd_item_global_tag_known(hidrd_item_global_tag tag)
{
assert(hidrd_item_global_tag_valid(tag));
return (tag <= HIDRD_ITEM_GLOBAL_TAG_KNOWN_MAX);
}
static inline bool
hidrd_item_global_tag_reserved(hidrd_item_global_tag tag)
{
assert(hidrd_item_global_tag_valid(tag));
return (tag >= HIDRD_ITEM_GLOBAL_TAG_RESERVED_MIN) &&
(tag <= HIDRD_ITEM_GLOBAL_TAG_RESERVED_MAX);
}
HIDRD_ITEM_SHORT_GEN_FUNCS(global, GLOBAL)
#define HIDRD_ITEM_GLOBAL_FUNCS(_name, _NAME, \
_sign, _int_type, _ext_type) \
static inline bool \
hidrd_item_##_name##_valid_class(const hidrd_item *item) \
{ \
return hidrd_item_global_valid_class(item) && \
hidrd_item_global_get_tag(item) == \
HIDRD_ITEM_GLOBAL_TAG_##_NAME; \
} \
\
static inline bool \
hidrd_item_##_name##_valid_inst(const hidrd_item *item) \
{ \
assert(hidrd_item_##_name##_valid_class(item)); \
return hidrd_item_global_valid_inst(item) && \
hidrd_item_##_name##_value_valid( \
(_int_type)hidrd_item_global_get_##_sign(item)); \
} \
\
static inline bool \
hidrd_item_##_name##_valid(const hidrd_item *item) \
{ \
return hidrd_item_##_name##_valid_class(item) && \
hidrd_item_##_name##_valid_inst(item); \
} \
\
static inline hidrd_item * \
hidrd_item_##_name##_validate(hidrd_item *item) \
{ \
assert(hidrd_item_##_name##_valid(item)); \
return item; \
} \
\
static inline _ext_type \
hidrd_item_##_name##_get_value(const hidrd_item *item) \
{ \
_int_type value; \
assert(hidrd_item_##_name##_valid(item)); \
value = (_int_type)hidrd_item_global_get_##_sign(item); \
assert(hidrd_item_##_name##_value_valid(value)); \
return (_ext_type)value; \
} \
\
static inline hidrd_item * \
hidrd_item_##_name##_set_value(hidrd_item *item, _ext_type value) \
{ \
assert(hidrd_item_##_name##_valid(item)); \
assert(hidrd_item_##_name##_value_valid((_int_type)value)); \
return hidrd_item_global_set_##_sign(item, (_int_type)value); \
} \
\
static inline hidrd_item * \
hidrd_item_##_name##_init(hidrd_item *item, _ext_type value) \
{ \
assert(hidrd_item_##_name##_value_valid((_int_type)value)); \
\
return hidrd_item_##_name##_validate( \
hidrd_item_global_init_##_sign( \
item, HIDRD_ITEM_GLOBAL_TAG_##_NAME, \
(_int_type)value)); \
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __HIDRD_ITEM_GLOBAL_H__ */
|