From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44DA881ACA; Sun, 29 Jun 2025 09:22:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751188980; cv=none; b=VNsfkbMZa3mAVt6uUyg2cH9834n9XJ+wz1l1uyVKdqZ3Eql/+7s/ib9JrVX0ehjSq2F0kmsHCgiSWkLkG7C11hIzLp5eX5pRyhDzqysMgZ/YmGeLWXPszmXCtgXLGdwYohiCpH3raUyo4HK1IyOCANrkSM55gMPdxR9r17xbbm4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751188980; c=relaxed/simple; bh=Njb3fwy0Bu5ps4Sk1pdRgG4rIqqg+bghfFOmUCWieXU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rjEvnn/4+ebzqesertuQAYV4JC0yR6f/5aQlHpXQuEic4fhwKZHrIVSC2IldKAHdWFwOyF3u/CesqrSFxcePRmIGJmM905bV43I8DAcDZQ0UCOtJk6iuHSXBbtTHlk7eOJPoPa0BZsUHxqcbep5DlXBSoKTyUVe04AlWUzWyZbg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PlNZTMsO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PlNZTMsO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E06FDC4CEEB; Sun, 29 Jun 2025 09:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751188979; bh=Njb3fwy0Bu5ps4Sk1pdRgG4rIqqg+bghfFOmUCWieXU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PlNZTMsOlVMnMveJjPdgYOniMGeOqEO9oZGEtQQy0e0eD4voKT+vi68C6ruT/mG9j YzoL9LYExfj+PLS3+wWLVE7iDIg1y/GCV52FnuRTAm67GQ6AjXh5ebXpa3whRsGbVX gDo1zLDY/Q+MdZaHobdvAuybBtbztGqwOK+6aIFe1iQQzwHmCZWmWN3v8In5VeoHXE Vijo4nswkIKNmOc68PVOGXNyMxu8bvQi96ltoZbp4o+jF1RDcxaQVOs0Cumkat1xHO Pqb7MtqlVWIi95+QbfKItIZlxHPPibPVsDUkw5eLXaKVwqPYhxhgYwWCIJ9VkIzmIk CBr1RCWTZYuNw== Date: Sun, 29 Jun 2025 11:22:54 +0200 From: Danilo Krummrich To: Rahul Rameshbabu Cc: linux-input@vger.kernel.org, rust-for-linux@vger.kernel.org, Benjamin Tissoires , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Daniel Brooks Subject: Re: [PATCH v1 3/3] rust: hid: Glorious Gaming PC Race Model O and O- mice reference driver Message-ID: References: <20250629045031.92358-2-sergeantsagara@protonmail.com> <20250629045031.92358-5-sergeantsagara@protonmail.com> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250629045031.92358-5-sergeantsagara@protonmail.com> On Sun, Jun 29, 2025 at 04:51:22AM +0000, Rahul Rameshbabu wrote: > +const USB_VENDOR_ID_SINOWEALTH: u32 = 0x258a; > +const USB_DEVICE_ID_GLORIOUS_MODEL_O: u32 = 0x0036; As mentioned in the other patch, I think we shouldn't duplicate them, but use the ones from drivers/hid/hid-ids.h. > +struct GloriousRust; > + > +kernel::hid_device_table!( > + HID_TABLE, > + MODULE_HID_TABLE, > + ::IdInfo, > + [( > + hid::DeviceId::new_usb( > + hid::Group::Generic, > + USB_VENDOR_ID_SINOWEALTH, > + USB_DEVICE_ID_GLORIOUS_MODEL_O, > + ), > + (), > + )] > +); > + > +#[vtable] > +impl hid::Driver for GloriousRust { > + type IdInfo = (); > + const ID_TABLE: hid::IdTable = &HID_TABLE; > + > + /// Glorious Model O and O- specify the const flag in the consumer input > + /// report descriptor, which leads to inputs being ignored. Fix this by > + /// patching the descriptor. > + fn report_fixup<'a, 'b: 'a>(_hdev: &hid::Device, rdesc: &'b mut [u8]) -> &'a [u8] { > + if rdesc.len() == 213 > + && rdesc[84] == 129 > + && rdesc[112] == 129 > + && rdesc[140] == 129 > + && rdesc[85] == 3 > + && rdesc[113] == 3 > + && rdesc[141] == 3 > + { > + pr_info!("patching Glorious Model O consumer control report descriptor\n"); Please use dev_dbg!() instead. > + > + rdesc[85] = hid::MAIN_ITEM_VARIABLE | hid::MAIN_ITEM_RELATIVE; > + rdesc[113] = hid::MAIN_ITEM_VARIABLE | hid::MAIN_ITEM_RELATIVE; > + rdesc[141] = hid::MAIN_ITEM_VARIABLE | hid::MAIN_ITEM_RELATIVE; > + } > + > + rdesc > + } > +} > + > +kernel::module_hid_driver! { > + type: GloriousRust, > + name: "GloriousRust", > + authors: ["Rahul Rameshbabu "], > + description: "Rust reference HID driver for Glorious Model O and O- mice", > + license: "GPL", > +} > -- > 2.49.0 > >