From owner-freebsd-usb@FreeBSD.ORG Sat Mar 20 21:11:18 2010 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 83FE71065673 for ; Sat, 20 Mar 2010 21:11:18 +0000 (UTC) (envelope-from kaiwang27@gmail.com) Received: from mail-ew0-f227.google.com (mail-ew0-f227.google.com [209.85.219.227]) by mx1.freebsd.org (Postfix) with ESMTP id 0F16B8FC15 for ; Sat, 20 Mar 2010 21:11:17 +0000 (UTC) Received: by ewy27 with SMTP id 27so200319ewy.13 for ; Sat, 20 Mar 2010 14:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:received :x-authentication-warning:date:from:to:subject:message-id :mime-version:content-type:content-disposition:user-agent; bh=31zovCDG8x7IqNTAyM9bkb0R+UuRCJIlxdcUoYLGWEM=; b=oUEepF7Qls9NGwkj2riZmlTSqPueIDkK8WjX7mOD3MA4FDfEtGDFcKC8+35rrwWRlE m56tEgAuSB8VL6PQ3wjdoSJ8JlyCzbLkQOHZtE8kCp0e5/qGFqMd/8fbT211c2ZY4pCX SoVXM2ZMLfZmrOUcHBXoAaXzZNwPrDH0NlkOI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=x-authentication-warning:date:from:to:subject:message-id :mime-version:content-type:content-disposition:user-agent; b=XbwQleNnKBAJM5Ntt5YveC0BtfqLFbRstYJEO/Px0cUL/oV8VZ0wLOFzTMAWubDsjv cZSKbcWHHjWnyJh+DS9MIu2wRVvYKpiwp2bEAvXrw3sM3DsyqCP/w3t2lE8phwYIPVP3 OAPVgy5dx/jiAhoPD6iQWAFZRMe1lIcPOO8q0= Received: by 10.213.1.148 with SMTP id 20mr1634090ebf.89.1269119476726; Sat, 20 Mar 2010 14:11:16 -0700 (PDT) Received: from localhost (81-233-38-26-no36.tbcn.telia.com [81.233.38.26]) by mx.google.com with ESMTPS id 16sm910537ewy.15.2010.03.20.14.11.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 20 Mar 2010 14:11:16 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=localhost.my.domain) by localhost with esmtp (Exim 4.71 (FreeBSD)) (envelope-from ) id 1Nt5wx-000118-0l for freebsd-usb@freebsd.org; Sat, 20 Mar 2010 22:11:15 +0100 Received: (from kaiw@localhost) by localhost.my.domain (8.14.3/8.14.3/Submit) id o2KLBEdH003913 for freebsd-usb@freebsd.org; Sat, 20 Mar 2010 22:11:14 +0100 (CET) (envelope-from kaiwang27@gmail.com) X-Authentication-Warning: localhost.my.domain: kaiw set sender to kaiwang27@gmail.com using -f Date: Sat, 20 Mar 2010 22:11:14 +0100 From: Kai Wang To: freebsd-usb@freebsd.org Message-ID: <20100320211114.GB2798@viskning> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Subject: [CFT] usbhid(3) improvements 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: Sat, 20 Mar 2010 21:11:18 -0000 Hi list, I've prepared a patch that merges some kernel USB HID parser improvements back to the userland usbhid(3) library. The patch is available here: http://people.freebsd.org/~kaiw/usbhid.diff To apply and reinstall usbhid(3) library: # cd /usr/src/lib/libusbhid # patch -p0 < path/to/usbhid.diff # make clean && make && make install The changes I've made: * Merge multiple report ID support and other improvements from kernel HID parser. * Ignore rid argument in hid_start_parser, parse all the report items since we now support multiple report ID. * Skip report ID byte in hid_get_data and set report ID byte hid_set_data if report ID is non-zero. * Reimplement hid_get_report_id, instead get report id from uhid device (which is always 0), try parsing the report descriptor and return the first ID encountered. The patch does not change the usbhid(3) API and should not break any native or third party usbhid(3) application. Instead, it should make them work better. If you are using the usbhid(3) library, usbhidctl(1), usbhidaction(1) or ports like devel/sdl12 etc, could you please help test if this patch breaks anything? Thanks, Kai