Module Name:    src
Committed By:   christos
Date:           Wed Mar  4 01:23:08 UTC 2020

Modified Files:
        src/sys/dev/usb: uhid.c usbhid.h

Log Message:
Add ioctls to get and set raw mode.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/usb/uhid.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/usb/usbhid.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/uhid.c
diff -u src/sys/dev/usb/uhid.c:1.112 src/sys/dev/usb/uhid.c:1.113
--- src/sys/dev/usb/uhid.c:1.112	Mon Mar  2 13:15:28 2020
+++ src/sys/dev/usb/uhid.c	Tue Mar  3 20:23:08 2020
@@ -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_l
 		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;

Index: src/sys/dev/usb/usbhid.h
diff -u src/sys/dev/usb/usbhid.h:1.18 src/sys/dev/usb/usbhid.h:1.19
--- src/sys/dev/usb/usbhid.h:1.18	Sun Jul 15 14:36:51 2018
+++ src/sys/dev/usb/usbhid.h	Tue Mar  3 20:23:08 2020
@@ -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_ */

Reply via email to