Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Add ioctls to get and set raw mode.



details:   https://anonhg.NetBSD.org/src/rev/4288af681bbf
branches:  trunk
changeset: 969873:4288af681bbf
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Mar 04 01:23:08 2020 +0000

description:
Add ioctls to get and set raw mode.

diffstat:

 sys/dev/usb/uhid.c   |  12 ++++++++++--
 sys/dev/usb/usbhid.h |   6 +++++-
 2 files changed, 15 insertions(+), 3 deletions(-)

diffs (58 lines):

diff -r 0273c8368fb0 -r 4288af681bbf sys/dev/usb/uhid.c
--- a/sys/dev/usb/uhid.c        Wed Mar 04 01:21:17 2020 +0000
+++ b/sys/dev/usb/uhid.c        Wed Mar 04 01:23:08 2020 +0000
@@ -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 @@
                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;
diff -r 0273c8368fb0 -r 4288af681bbf sys/dev/usb/usbhid.h
--- a/sys/dev/usb/usbhid.h      Wed Mar 04 01:21:17 2020 +0000
+++ b/sys/dev/usb/usbhid.h      Wed Mar 04 01:23:08 2020 +0000
@@ -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 @@
 #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_ */



Home | Main Index | Thread Index | Old Index