From owner-freebsd-usb@FreeBSD.ORG Fri May 7 09:57:49 2010 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 EA9101065672 for ; Fri, 7 May 2010 09:57:48 +0000 (UTC) (envelope-from kaiwang27@gmail.com) Received: from mail-ew0-f224.google.com (mail-ew0-f224.google.com [209.85.219.224]) by mx1.freebsd.org (Postfix) with ESMTP id 6AC5B8FC1A for ; Fri, 7 May 2010 09:57:47 +0000 (UTC) Received: by ewy24 with SMTP id 24so211064ewy.33 for ; Fri, 07 May 2010 02:57:37 -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:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=z/z4a2JXXeOwINGEcy4L5O1hJVfzoy5SuHnZ8leis9c=; b=t2pY/Fw6jQASg34vK0N2ALj1kkk/2Zp7lrvn2KT9uDdd1E6wd/puW0dCFKq7cxEPZa dUQ/Wz3MmVPbk/wb7OildmYgQiuoHo4dvRyaHlc6txUzYVpQo0HOy2+Lgdv4k+ZtYzZI zHb02WISNacsgOe8eFB5mBeDsSU3ut4zf7Xao= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=x-authentication-warning:date:from:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; b=jg8U1M8fM5eoPA/zSjHSOvSlnZGxnoqX6WK+Eldq0KFulNBqxzin8FL+Gue7kuIRdG sIIMr6j2d8nlEJ95FMp8G8v4xgyMA+bUsvuD/2XYAs38o0rL5VzCgC7qG8KxHkiikVoD BF8cgfDXuxpYXNa9UP6YMv2wE17VZOJx6eOc8= Received: by 10.213.41.142 with SMTP id o14mr3846721ebe.18.1273226257228; Fri, 07 May 2010 02:57:37 -0700 (PDT) Received: from localhost (81-233-38-26-no36.tbcn.telia.com [81.233.38.26]) by mx.google.com with ESMTPS id 14sm1060751ewy.14.2010.05.07.02.57.35 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 07 May 2010 02:57:35 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=localhost.my.domain) by localhost with esmtp (Exim 4.71 (FreeBSD)) (envelope-from ) id 1OAKJ5-0000nj-4O; Fri, 07 May 2010 11:57:19 +0200 Received: (from kaiw@localhost) by localhost.my.domain (8.14.3/8.14.3/Submit) id o479vJZg003082; Fri, 7 May 2010 11:57:19 +0200 (CEST) (envelope-from kaiwang27@gmail.com) X-Authentication-Warning: localhost.my.domain: kaiw set sender to kaiwang27@gmail.com using -f Date: Fri, 7 May 2010 11:57:18 +0200 From: Kai Wang To: Alex Deiter Message-ID: <20100507095718.GA3047@viskning> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="huq684BweRXVnRxX" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-bluetooth@freebsd.org, current@freebsd.org, freebsd-usb@freebsd.org, hps@freebsd.org Subject: Re: Revision 205728: broken bluetooth mouse support 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, 07 May 2010 09:57:49 -0000 --huq684BweRXVnRxX Content-Type: text/plain; charset=utf-8 Content-Disposition: inline On Fri, May 07, 2010 at 01:58:13AM +0400, Alex Deiter wrote: > Hi, > > Bluetooth mouse support is broken after Revision 205728: > > http://svn.freebsd.org/viewvc/base?view=revision&revision=205728 > > When I move the mouse - cursor stays in same place but moves the > current position of the console. > > Proposed patch as an attachment. Could you please revew this ? Hi Alex, If we adopt your patch, usbhidctl(1) and usbhidaction(1) will be broken again on device with multiple report IDs. Could you please try if the attached patch for the bthidd(8) daemon works as well? Thanks, Kai --huq684BweRXVnRxX Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="bthidd.txt" Index: usr.sbin/bluetooth/bthidd/hid.c =================================================================== --- usr.sbin/bluetooth/bthidd/hid.c (revision 207113) +++ usr.sbin/bluetooth/bthidd/hid.c (working copy) @@ -130,7 +130,7 @@ hid_interrupt(bthid_session_p s, uint8_t *data, in hid_item_t h; int32_t report_id, usage, page, val, mouse_x, mouse_y, mouse_z, mouse_butt, - mevents, kevents; + mevents, kevents, i; assert(s != NULL); assert(s->srv != NULL); @@ -150,8 +150,8 @@ hid_interrupt(bthid_session_p s, uint8_t *data, in } report_id = data[1]; - data += 2; - len -= 2; + data ++; + len --; hid_device = get_hid_device(&s->bdaddr); assert(hid_device != NULL); @@ -202,17 +202,11 @@ hid_interrupt(bthid_session_p s, uint8_t *data, in if (val && val < kbd_maxkey()) bit_set(s->keys1, val); - data ++; - len --; - - len = min(len, h.report_size); - while (len > 0) { + for (i = 1; i < h.report_count; i++) { + h.pos += h.report_size; val = hid_get_data(data, &h); if (val && val < kbd_maxkey()) bit_set(s->keys1, val); - - data ++; - len --; } } break; --huq684BweRXVnRxX--