From owner-freebsd-usb@FreeBSD.ORG Fri Jun 1 17:11:19 2012 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C61E106566C; Fri, 1 Jun 2012 17:11:19 +0000 (UTC) (envelope-from ee@athyriogames.com) Received: from madonna.sslcatacombnetworking.com (madonna.sslcatacombnetworking.com [174.133.19.130]) by mx1.freebsd.org (Postfix) with ESMTP id 5336D8FC0C; Fri, 1 Jun 2012 17:11:19 +0000 (UTC) Received: from c-98-206-215-156.hsd1.in.comcast.net ([98.206.215.156] helo=laptopv) by madonna.sslcatacombnetworking.com with esmtpa (Exim 4.69) (envelope-from ) id 1SaVHL-0006Rx-Ka; Fri, 01 Jun 2012 12:04:47 -0500 From: "Engineering" To: "'Hans Petter Selasky'" , "'Alexander Motin'" References: <201205280640.q4S6e6L0035127@freefall.freebsd.org> <201206011730.31081.hselasky@c2i.net> <027901cd4011$53ec4ff0$fbc4efd0$@com> <201206011823.30527.hselasky@c2i.net> In-Reply-To: <201206011823.30527.hselasky@c2i.net> Date: Fri, 1 Jun 2012 12:10:13 -0500 Message-ID: <028301cd4019$69eafba0$3dc0f2e0$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac1AEhgCPRZCJzKXRp2widT/5OZ5agABdYDw Content-Language: en-us X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - madonna.sslcatacombnetworking.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - athyriogames.com Cc: freebsd-usb@freebsd.org Subject: RE: Recommendations for programming HID in FreeBSD 9 X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2012 17:11:19 -0000 -----Original Message----- >From: Hans Petter Selasky [mailto:hselasky@c2i.net] > >I think mav @ did some work in that area? > >Are you sure you cannot use: >... > if (id != 0) > copyin(ugd->ugd_data, &id, 1); > error = uhid_set_report(sc, ugd->ugd_report_type, id, > NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size)); > break; That's definitely cleaner, using the ugd fields to denote a special case. I'm not sure about the (id != 0) - I'll need to check my specific devices, but something like: if(ugd->ugd_config_index) // abusing variables to set a flag, use passed in id and size in lang_id and actlen error = uhid_set_report(sc, ugd->ugd_report_type, ugd->ugd_lang_id, NULL, ugd->ugd_data, ugd->ugd_actlen); else error = uhid_set_report(sc, ugd->ugd_report_type, id, NULL, ugd->ugd_data, size); Would suit my needs well, as long as I remember to zero out ugd_config_index on a normal one! I suppose I need to rebuild the kernel. Thanks for your time and help! Sam