Add ioctls to get and set raw mode.

This commit is contained in:
christos 2020-03-04 01:23:08 +00:00
parent da570a6238
commit 83f5a6a60a
2 changed files with 15 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uhid.c,v 1.112 2020/03/02 18:15:28 christos Exp $ */
/* $NetBSD: uhid.c,v 1.113 2020/03/04 01:23:08 christos Exp $ */
/*
* Copyright (c) 1998, 2004, 2008, 2012 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.112 2020/03/02 18:15:28 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.113 2020/03/04 01:23:08 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@ -602,6 +602,14 @@ uhid_do_ioctl(struct uhid_softc *sc, u_long cmd, void *addr,
mutex_exit(proc_lock);
break;
case USB_HID_GET_RAW:
*(int *)addr = sc->sc_raw;
break;
case USB_HID_SET_RAW:
sc->sc_raw = *(int *)addr;
break;
case USB_GET_REPORT_DESC:
uhidev_get_report_desc(sc->sc_hdev.sc_parent, &desc, &size);
rd = (struct usb_ctl_report_desc *)addr;

View File

@ -1,4 +1,4 @@
/* $NetBSD: usbhid.h,v 1.18 2018/07/15 18:36:51 maya Exp $ */
/* $NetBSD: usbhid.h,v 1.19 2020/03/04 01:23:08 christos Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbhid.h,v 1.7 1999/11/17 22:33:51 n_hibma Exp $ */
/*
@ -36,6 +36,7 @@
#define _DEV_USB_USBHID_H_
#include <dev/hid/hid.h>
#include <sys/ioccom.h>
#define UR_GET_HID_DESCRIPTOR 0x06
#define UDESC_HID 0x21
@ -66,4 +67,7 @@ typedef struct usb_hid_descriptor {
#define UHID_OUTPUT_REPORT 0x02
#define UHID_FEATURE_REPORT 0x03
#define USB_HID_GET_RAW _IOR('h', 1, int)
#define USB_HID_SET_RAW _IOW('h', 2, int)
#endif /* _DEV_USB_USBHID_H_ */