From nobody Sat Dec 24 08:37:01 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NfHTn4Fv1z1HST5; Sat, 24 Dec 2022 08:37:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NfHTn2M2lz3NqW; Sat, 24 Dec 2022 08:37:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671871021; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=A3Qzh4fDFfE2a/E+fGB5CACUeVpQpSTnGozpN0cUwWM=; b=ao3+kWUndldUqbg4ErQneCPlCWVlLFgAh8t/Rt6jSlsu1jEYhLploEQvLILnffcWvQq8s/ TV24VNIBFdDJswnI0zKja6unrNh0xfP4xcxSa4Xjr9lEIbftmoPk8My3/3IrjR4647PSeU tKZSUUh4L+nVI8ClvvJoamdtojCJ69qPAOBtiZ7OwYZnXcMnpZtjaNV+E7IpBDQ/Gm3UJA YgU4VJop75akThy79OUZg0t9es/FWXOoI2lSSef0L9gscVppt5LLUPSOteRJut6f1AWr05 umoRmlTrf6ZGJzOtpj4ataAueKw7UMgdLcf2B4gOuxUxj7Yppiik8WK6vhPcXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671871021; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=A3Qzh4fDFfE2a/E+fGB5CACUeVpQpSTnGozpN0cUwWM=; b=tqwwZZe6Z78QYEbZXkOVW7ETceVD04/sS9BWjIuGnChykU644+n+PvLF5rL4YF+sIKQ+Re 4mQDCacIbCBmc5pq9SW96KsYtxmY3MlTZQQCwwW5zUAm6Q8ZuQ/8NjkEk/jOlPqbN6bOPJ bhBtun5ZlG7/Ty+UpNoPcybhsY+gaLZ01Vt8YdiuN02dV6/Z3pVH3I4uGqvyGoA11q3V82 mJ3iqPuCrSXRp9lgG8P3B3myQ4aNPhWWxNy0xf9x1y32sC7h82TyKsg40nTLs8tHjEvTNU vZXZNgm6LCgn5I/FrDuqlhfqtqa18qpmGcsb5tm3XUeZIBTsqn4otzrOQt5frA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1671871021; a=rsa-sha256; cv=none; b=AAqUo7AxVp9ES930DrP6ZYSfBRLaajWN2a7ov0fM2XNKHYAXVLVPr3RrGw97dgREpaPSvz epymrvW9vo1Y5NwtvAPUeY+VvQAnJj77RBJvI0IP/B0wxL7c/Lahpv8rBwSQZ15W06YDKA 3CPGBZAJTufXZ+bWkmOzcA8adfUpA9MglhiOTj+XmJ+9VSYm/wdYHC+2Ci/BIyl3ugp3Rx RKKpSaegakgo4WD2sKgSov1pS8TxlpMc2CIWNd5BN5JKE/3sxylaN3MXEqs/C5MtlIWBdl QfAuGm6QUcx1QFEYgKw3INxOkkuC+mTpGtnZyhUDygWmoyMbnWPW1TyxiczDLg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NfHTn1Cqmz166j; Sat, 24 Dec 2022 08:37:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2BO8b1kn083454; Sat, 24 Dec 2022 08:37:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BO8b1SL083453; Sat, 24 Dec 2022 08:37:01 GMT (envelope-from git) Date: Sat, 24 Dec 2022 08:37:01 GMT Message-Id: <202212240837.2BO8b1SL083453@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 8f7ae0928ecf - stable/13 - usbhid(4): Implement USB_REQUEST command in hid_ioctl method List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8f7ae0928ecffdb4427ab44270f42e9612e28cfa Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=8f7ae0928ecffdb4427ab44270f42e9612e28cfa commit 8f7ae0928ecffdb4427ab44270f42e9612e28cfa Author: Vladimir Kondratyev AuthorDate: 2022-03-02 23:35:23 +0000 Commit: Vladimir Kondratyev CommitDate: 2022-12-24 08:33:26 +0000 usbhid(4): Implement USB_REQUEST command in hid_ioctl method This command is intended to be compatible with USB_REQUEST ioctl. It is required to perform arbitrary control endpoint requests by device drivers which can switch between HID and native non-HID modes. (cherry picked from commit 82e38b012cc832651ba195f5443e7f9fb64ce5d3) --- sys/dev/usb/input/usbhid.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/sys/dev/usb/input/usbhid.c b/sys/dev/usb/input/usbhid.c index c6f2a1f24303..ed76f6291a11 100644 --- a/sys/dev/usb/input/usbhid.c +++ b/sys/dev/usb/input/usbhid.c @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define USB_DEBUG_VAR usbhid_debug #include @@ -677,6 +678,35 @@ usbhid_set_protocol(device_t dev, uint16_t protocol) return (usbhid_sync_xfer(sc, USBHID_CTRL_DT, &req, NULL)); } +static int +usbhid_ioctl(device_t dev, unsigned long cmd, uintptr_t data) +{ + struct usbhid_softc* sc = device_get_softc(dev); + struct usb_ctl_request *ucr; + union usbhid_device_request req; + int error; + + switch (cmd) { + case USB_REQUEST: + ucr = (struct usb_ctl_request *)data; + req.ctrl = ucr->ucr_request; + error = usbhid_xfer_check_len( + sc, USBHID_CTRL_DT, UGETW(req.ctrl.wLength)); + if (error) + break; + + error = usbhid_sync_xfer( + sc, USBHID_CTRL_DT, &req, ucr->ucr_data); + if (error == 0) + ucr->ucr_actlen = UGETW(req.ctrl.wLength); + break; + default: + error = EINVAL; + } + + return (error); +} + static void usbhid_init_device_info(struct usb_attach_arg *uaa, struct hid_device_info *hw) { @@ -848,6 +878,7 @@ static device_method_t usbhid_methods[] = { DEVMETHOD(hid_set_report, usbhid_set_report), DEVMETHOD(hid_set_idle, usbhid_set_idle), DEVMETHOD(hid_set_protocol, usbhid_set_protocol), + DEVMETHOD(hid_ioctl, usbhid_ioctl), DEVMETHOD_END };