/usr/include/hidrd/fmt/inst.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 | /** @file
* @brief HID report descriptor - format instance
*
* Copyright (C) 2010 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: inst.h 225 2010-03-04 15:56:13Z spb_nick $
*/
#ifndef __HIDRD_FMT_INST_H__
#define __HIDRD_FMT_INST_H__
#include "hidrd/strm/src/inst.h"
#include "hidrd/strm/snk/inst.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Prototype for a function used to initialize format support.
*
* @return True if initialized successfully, false otherwise.
*/
typedef bool hidrd_fmt_init_fn(void);
/**
* Prototype for a function used to cleanup format support.
*/
typedef void hidrd_fmt_clnp_fn(void);
/** Format */
typedef struct hidrd_fmt {
const char *name; /**< Name */
const char *desc; /**< Human-readable description */
hidrd_fmt_init_fn *init; /**< Library initialization function */
hidrd_fmt_clnp_fn *clnp; /**< Library cleanup function */
const hidrd_src_type *src; /**< Source type */
const hidrd_snk_type *snk; /**< Sink type */
} hidrd_fmt;
/**
* Check if a format is valid.
*
* @param fmt Format to check.
*
* @return True if the format is valid, false otherwise.
*/
extern bool hidrd_fmt_valid(const hidrd_fmt *fmt);
/**
* Check if a format is readable.
*
* @param fmt Format to check.
*
* @return True if the format is readable, false otherwise.
*/
static inline bool
hidrd_fmt_readable(const hidrd_fmt *fmt)
{
assert(hidrd_fmt_valid(fmt));
return fmt->src != NULL;
}
/**
* Check if a format is writable.
*
* @param fmt Format to check.
*
* @return True if the format is writable, false otherwise.
*/
static inline bool
hidrd_fmt_writable(const hidrd_fmt *fmt)
{
assert(hidrd_fmt_valid(fmt));
return fmt->snk != NULL;
}
/**
* Initialize a format library, if needed.
*
* @param fmt Format to initialize.
*
* @return True if initialized successfully, false otherwise.
*/
static inline bool
hidrd_fmt_init(const hidrd_fmt *fmt)
{
assert(hidrd_fmt_valid(fmt));
return (fmt->init == NULL) || (*fmt->init)();
}
/**
* Cleanup a format library, if needed.
*
* @param fmt Format to cleanup.
*/
static inline void
hidrd_fmt_clnp(const hidrd_fmt *fmt)
{
assert(hidrd_fmt_valid(fmt));
if (fmt->clnp != NULL)
(*fmt->clnp)();
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __HIDRD_FMT_INST_H__ */
|