17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 23*6d9a41ffSqz * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _SYS_USB_HID_H 287c478bd9Sstevel@tonic-gate #define _SYS_USB_HID_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifdef __cplusplus 337c478bd9Sstevel@tonic-gate extern "C" { 347c478bd9Sstevel@tonic-gate #endif 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #define USB_DESCR_TYPE_HID 0x21 377c478bd9Sstevel@tonic-gate #define USB_HID_DESCR_SIZE 10 /* Hid descriptor length */ 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate /* 407c478bd9Sstevel@tonic-gate * HID : This header file defines the interface between the hid 417c478bd9Sstevel@tonic-gate * module and the hid driver. 427c478bd9Sstevel@tonic-gate */ 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate /* 457c478bd9Sstevel@tonic-gate * There is an M_CTL command per class specific HID command defined in 467c478bd9Sstevel@tonic-gate * section 7.2 of the specification. 477c478bd9Sstevel@tonic-gate */ 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate #define HID_GET_REPORT 0x0001 /* receive report */ 507c478bd9Sstevel@tonic-gate #define HID_GET_IDLE 0x0002 /* find the idle value */ 517c478bd9Sstevel@tonic-gate #define HID_GET_PROTOCOL 0x0003 /* get the protocol */ 527c478bd9Sstevel@tonic-gate #define HID_SET_REPORT 0x0009 /* send a report to device */ 537c478bd9Sstevel@tonic-gate #define HID_SET_IDLE 0x000a /* set the idle value */ 547c478bd9Sstevel@tonic-gate #define HID_SET_PROTOCOL 0x000b /* set the protocol */ 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gate /* 577c478bd9Sstevel@tonic-gate * Hid descriptor 587c478bd9Sstevel@tonic-gate */ 597c478bd9Sstevel@tonic-gate typedef struct usb_hid_descr { 607c478bd9Sstevel@tonic-gate uchar_t bLength; /* Size of this descriptor */ 617c478bd9Sstevel@tonic-gate uchar_t bDescriptorType; /* HID descriptor */ 627c478bd9Sstevel@tonic-gate ushort_t bcdHID; /* HID spec release */ 637c478bd9Sstevel@tonic-gate uchar_t bCountryCode; /* Country code */ 647c478bd9Sstevel@tonic-gate uchar_t bNumDescriptors; /* No. class descriptors */ 657c478bd9Sstevel@tonic-gate uchar_t bReportDescriptorType; /* Class descr. type */ 667c478bd9Sstevel@tonic-gate ushort_t wReportDescriptorLength; /* size of report descr */ 677c478bd9Sstevel@tonic-gate } usb_hid_descr_t; 687c478bd9Sstevel@tonic-gate 69*6d9a41ffSqz /* 70*6d9a41ffSqz * Hid device information 71*6d9a41ffSqz */ 72*6d9a41ffSqz typedef struct hid_vid_pid { 73*6d9a41ffSqz uint16_t VendorId; /* vendor ID */ 74*6d9a41ffSqz uint16_t ProductId; /* product ID */ 75*6d9a41ffSqz } hid_vid_pid_t; 76*6d9a41ffSqz 777c478bd9Sstevel@tonic-gate /* 787c478bd9Sstevel@tonic-gate * Hid will turn the M_CTL request into a request control request on the 797c478bd9Sstevel@tonic-gate * default pipe. Hid needs the following information in the hid_req_t 807c478bd9Sstevel@tonic-gate * structure. See the details below for specific values for each command. 817c478bd9Sstevel@tonic-gate */ 827c478bd9Sstevel@tonic-gate typedef struct hid_req_struct { 837c478bd9Sstevel@tonic-gate uint16_t hid_req_version_no; /* Version number */ 847c478bd9Sstevel@tonic-gate uint16_t hid_req_wValue; /* wValue field of request */ 857c478bd9Sstevel@tonic-gate uint16_t hid_req_wLength; /* wLength of request */ 867c478bd9Sstevel@tonic-gate mblk_t *hid_req_data; /* data for send case */ 877c478bd9Sstevel@tonic-gate } hid_req_t; 887c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("unique per call", hid_req_t)) 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate /* 917c478bd9Sstevel@tonic-gate * hid_req_wValue values HID_GET_REPORT and HID_SET_REPORT 927c478bd9Sstevel@tonic-gate */ 937c478bd9Sstevel@tonic-gate #define REPORT_TYPE_INPUT 0x0100 /* Input report */ 947c478bd9Sstevel@tonic-gate #define REPORT_TYPE_OUTPUT 0x0200 /* Output report */ 957c478bd9Sstevel@tonic-gate #define REPORT_TYPE_FEATURE 0x0300 /* Feature report */ 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gate /* 997c478bd9Sstevel@tonic-gate * hid_req_wLength value for HID_GET_IDLE and HID_SET_IDLE 1007c478bd9Sstevel@tonic-gate */ 1017c478bd9Sstevel@tonic-gate #define GET_IDLE_LENGTH 0x0001 1027c478bd9Sstevel@tonic-gate #define SET_IDLE_LENGTH 0x0000 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate /* 1057c478bd9Sstevel@tonic-gate * hid_req_wValue values for SET_PROTOCOL 1067c478bd9Sstevel@tonic-gate */ 1077c478bd9Sstevel@tonic-gate #define SET_BOOT_PROTOCOL 0x0000 /* Boot protocol */ 1087c478bd9Sstevel@tonic-gate #define SET_REPORT_PROTOCOL 0x0001 /* Report protocol */ 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate /* 1117c478bd9Sstevel@tonic-gate * return values for GET_PROTOCOL 1127c478bd9Sstevel@tonic-gate */ 1137c478bd9Sstevel@tonic-gate #define BOOT_PROTOCOL 0x00 /* Returned boot protocol */ 1147c478bd9Sstevel@tonic-gate #define REPORT_PROTOCOL 0x01 /* Returned report protocol */ 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate /* 1177c478bd9Sstevel@tonic-gate * There is an additional M_CTL command for obtaining the 1187c478bd9Sstevel@tonic-gate * hid parser handle. This M_CTL returns a pointer to the handle. 1197c478bd9Sstevel@tonic-gate * The type of the pointer is intpr_t because this type is large enough to 1207c478bd9Sstevel@tonic-gate * hold any data pointer. 1217c478bd9Sstevel@tonic-gate */ 1227c478bd9Sstevel@tonic-gate #define HID_GET_PARSER_HANDLE 0x0100 /* obtain parser handle */ 1237c478bd9Sstevel@tonic-gate 124*6d9a41ffSqz /* 125*6d9a41ffSqz * The M_CTL command is to get the device vendor ID and product ID. 126*6d9a41ffSqz */ 127*6d9a41ffSqz #define HID_GET_VID_PID 0x0200 /* obtain device info */ 128*6d9a41ffSqz 1297c478bd9Sstevel@tonic-gate /* 1307c478bd9Sstevel@tonic-gate * M_CTL commands for event notifications 1317c478bd9Sstevel@tonic-gate */ 1327c478bd9Sstevel@tonic-gate #define HID_POWER_OFF 0x00DC 1337c478bd9Sstevel@tonic-gate #define HID_FULL_POWER 0x00DD 1347c478bd9Sstevel@tonic-gate #define HID_DISCONNECT_EVENT 0x00DE 1357c478bd9Sstevel@tonic-gate #define HID_CONNECT_EVENT 0x00DF 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate /* 1387c478bd9Sstevel@tonic-gate * To get the report descriptor, 1397c478bd9Sstevel@tonic-gate * This is the wValue 1407c478bd9Sstevel@tonic-gate */ 1417c478bd9Sstevel@tonic-gate #define USB_CLASS_DESCR_TYPE_REPORT 0x2200 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gate /* Version numbers */ 1457c478bd9Sstevel@tonic-gate #define HID_VERSION_V_0 0 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1487c478bd9Sstevel@tonic-gate } 1497c478bd9Sstevel@tonic-gate #endif 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_HID_H */ 152