include/linux/hid-over-spi.h

Source file repositories/reference/linux-study-clean/include/linux/hid-over-spi.h

File Facts

System
Linux kernel
Corpus path
include/linux/hid-over-spi.h
Extension
.h
Size
5023 bytes
Lines
156
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct input_report_body_header {
	u8 input_report_type;
	__le16 content_len;
	u8 content_id;
} __packed;

#define HIDSPI_INPUT_BODY_HEADER_SIZE	sizeof(struct input_report_body_header)

/**
 * struct input_report_body - Input report body definition in HIDSPI protocol
 * @body_hdr: input report body header
 * @content: input report body content
 */
struct input_report_body {
	struct input_report_body_header body_hdr;
	u8 content[];
} __packed;

#define HIDSPI_INPUT_BODY_SIZE(content_len)	((content_len) + HIDSPI_INPUT_BODY_HEADER_SIZE)

/**
 * struct output_report_header - Output report header definition in HIDSPI protocol
 * @report_type: output report type, reference to enum output_report_type
 * @content_len: length of content
 * @content_id: 0x00 - descriptors
 *              report id - Set/Feature feature or Input/Output Reports
 *              command opcode - for commands
 */
struct output_report_header {
	u8 report_type;
	__le16 content_len;
	u8 content_id;
} __packed;

#define HIDSPI_OUTPUT_REPORT_HEADER_SIZE	sizeof(struct output_report_header)

/**
 * struct output_report - Output report definition in HIDSPI protocol
 * @output_hdr: output report header
 * @content: output report content
 */
struct output_report {
	struct output_report_header output_hdr;
	u8 content[];
} __packed;

#define HIDSPI_OUTPUT_REPORT_SIZE(content_len)	((content_len) + HIDSPI_OUTPUT_REPORT_HEADER_SIZE)

/**
 * struct hidspi_dev_descriptor - HIDSPI device descriptor definition
 * @dev_desc_len: The length of the complete device descriptor, fixed to 0x18 (24).
 * @bcd_ver: The version number of the HIDSPI protocol supported.
 *           In binary coded decimal (BCD) format. Must be fixed to 0x0300.
 * @rep_desc_len: The length of the report descriptor
 * @max_input_len: The length of the largest possible HID input (or feature) report
 * @max_output_len: The length of the largest output (or feature) report
 * @max_frag_len: The length of the largest fragment, where a fragment represents
 *                the body of an input report.
 * @vendor_id: Device manufacturers vendor ID
 * @product_id: Device unique model/product ID
 * @version_id: Device’s unique version
 * @flags: Specify flags for the device’s operation
 * @reserved: Reserved and should be 0
 */
struct hidspi_dev_descriptor {
	__le16 dev_desc_len;
	__le16 bcd_ver;
	__le16 rep_desc_len;
	__le16 max_input_len;
	__le16 max_output_len;
	__le16 max_frag_len;
	__le16 vendor_id;
	__le16 product_id;
	__le16 version_id;
	__le16 flags;
	__le32 reserved;
};

#define HIDSPI_DEVICE_DESCRIPTOR_SIZE		sizeof(struct hidspi_dev_descriptor)
#define HIDSPI_INPUT_DEVICE_DESCRIPTOR_SIZE	\
	(HIDSPI_INPUT_BODY_HEADER_SIZE + HIDSPI_DEVICE_DESCRIPTOR_SIZE)

#endif /* _HID_OVER_SPI_H_ */

Annotation

Implementation Notes