From owner-freebsd-usb@FreeBSD.ORG Sat Jun 2 06:55:10 2012 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E09391065672 for ; Sat, 2 Jun 2012 06:55:10 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by mx1.freebsd.org (Postfix) with ESMTP id 626268FC12 for ; Sat, 2 Jun 2012 06:55:10 +0000 (UTC) Received: by wibhj8 with SMTP id hj8so1038353wib.13 for ; Fri, 01 Jun 2012 23:55:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=jlHAxKw95u7p5LG1i3fPfMRlUUrMY61vX0wt2hUxtcw=; b=P22UPIrIyPMbph1EiRfgX5+CKeZVBA6hIObwurCFAe+kQ9TB6cRMrEcfQ1ma1ToZlr iW6mO299Jl4nK7AKZl62QRjT8a1k5FhMAFQesagNCUmuyWPAoaeMVr5EASj39nVtgC49 RhyIultfNlnUsDA0X0glcDKHzuUtwu/PIDcxBV+AgO+cT9VAAptSILQuvFLIlGDrXo5Z dXCJbCx4qwIOvijQ5d9xIfFHY6TOxmpEcZk9AUpefwahKccQ7D2zXLhdywGexAjx99Jc fmnIKe+wEIYl3T+8QM3Jt8WNVtRDMM6+ELI27tvpgUcnCRazfSXh5h0j0G6Z8lVOZife tzJA== Received: by 10.216.139.73 with SMTP id b51mr4459056wej.72.1338620108496; Fri, 01 Jun 2012 23:55:08 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id z8sm4112519wiy.1.2012.06.01.23.55.06 (version=SSLv3 cipher=OTHER); Fri, 01 Jun 2012 23:55:07 -0700 (PDT) Sender: Alexander Motin Message-ID: <4FC9B8C9.9060103@FreeBSD.org> Date: Sat, 02 Jun 2012 09:55:05 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.3) Gecko/20120328 Thunderbird/10.0.3 MIME-Version: 1.0 To: Engineering References: <201205280640.q4S6e6L0035127@freefall.freebsd.org> <201206011730.31081.hselasky@c2i.net> <027901cd4011$53ec4ff0$fbc4efd0$@com> <201206011823.30527.hselasky@c2i.net> <028301cd4019$69eafba0$3dc0f2e0$@com> In-Reply-To: <028301cd4019$69eafba0$3dc0f2e0$@com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: Sat, 02 Jun 2012 06:55:11 -0000 Hi. On 06/01/12 20:10, Engineering wrote: > -----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: Hans is right. That code should do the trick. Last year I've fixed uhid driver to handle multiple report IDs. Even user-level tools are able to do it now. "id != 0" should be correct condition. According to HID spec, if device has at least one non-zero report ID, report ID should be included into any transfer. So now uhid driver assumes that report ID should be in the first byte of request, if it found some non-zero ID in descriptor. -- Alexander Motin