From owner-freebsd-current@FreeBSD.ORG Tue Nov 15 21:34:42 2011 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9702E106566B; Tue, 15 Nov 2011 21:34:42 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id E41A18FC0C; Tue, 15 Nov 2011 21:34:41 +0000 (UTC) Received: by bkbzs8 with SMTP id zs8so10595833bkb.13 for ; Tue, 15 Nov 2011 13:34:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=VJBW3+hpq0BUjZZzESDxoWH2nlkiD1c7tHj/38tSLN0=; b=QyYf0m3gOs5eXjHrDuQPNZ8HIsPApaKl1B+OFAcn3ulqSMz1hp8ZMG7Gn2bE/4MgYI cnMlQRiwNMEJqY6VfnSYd8TYX3M6kJwYih35M+e/El4u2cFVH7eNOBsjuTLQ4MPWc9px j0R1Dw7gmMQk7V+ErznYBug6xZWTeatxERv9w= Received: by 10.205.138.129 with SMTP id is1mr18282901bkc.120.1321392880593; Tue, 15 Nov 2011 13:34:40 -0800 (PST) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id x19sm18482929fag.5.2011.11.15.13.34.38 (version=SSLv3 cipher=OTHER); Tue, 15 Nov 2011 13:34:39 -0800 (PST) Sender: Alexander Motin Message-ID: <4EC2DAEF.70900@FreeBSD.org> Date: Tue, 15 Nov 2011 23:34:39 +0200 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111112 Thunderbird/8.0 MIME-Version: 1.0 To: Marcus von Appen References: <4EC2C757.4060303@FreeBSD.org> <20111115205406.GB1922@medusa.sysfault.org> In-Reply-To: <20111115205406.GB1922@medusa.sysfault.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: current Subject: Re: uhid(4) and report structures X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2011 21:34:42 -0000 On 15.11.2011 22:54, Marcus von Appen wrote: > On, Tue Nov 15, 2011, Alexander Motin wrote: > >> On 15.11.2011 21:29, Marcus von Appen wrote: >>> I wonder, if I am correct with my assumption that the usb_ctl_report* >>> structures mentioned in uhid(4) have to be defined and created by the >>> code portion that uses the USB_GET_REPORT(), USB_SET_REPORT(), >>> ... calls. >>> >>> In FreeBSD< 800063 we defined them in the header files of the USB >>> subsystem. After the rewrite those struct definitions vanished. Will >>> the USB_ macros mentioned in uhid(4) "just" return a byte sequence >>> (that's what I understand from the UHID specification) so that code, >>> which uses those calls, can implement its own struct container for the >>> information retrieved? >>> >>> Thanks for shedding some light on this. In case i am correct with what I >>> wrote above, it might make sense to mention it in uhid(4). >> >> In new USB stack these calls use struct usb_gen_descriptor argument. >> Difficult to say why it was done, but it was. To hide that I've recently >> added two wrapper functions to the libusbhid in HEAD: hid_get_report() >> and hid_set_report(). > > So the man page is currently not up to date and can - at least for now - > be assumed to be wrong? > To get the mappings correct, which fields would I have to use from > usb_gen_descriptor? Earlier we had: > > struct usb_ctl_report { > int ucr_report; > u_char ucr_data[1024]; > }; > > The mapping might be: > > usb_gen_descriptor.ugd_data == usb_ctl_report.ucr_data > usb_gen_descriptor.ugd_report_type == usb_ctl_report.ucr_report > > Is that correct? Also, ugd_data is of variable size with ugd_actlen > indicating the size of the ugd_data buffer? Here is usage example: http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libusbhid/data.c.diff?r1=1.9;r2=1.10;f=h -- Alexander Motin