From owner-freebsd-bluetooth@FreeBSD.ORG Tue May 3 20:01:46 2011 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAF001065670 for ; Tue, 3 May 2011 20:01:46 +0000 (UTC) (envelope-from maksim.yevmenkin@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 41B138FC17 for ; Tue, 3 May 2011 20:01:45 +0000 (UTC) Received: by bwz12 with SMTP id 12so598391bwz.13 for ; Tue, 03 May 2011 13:01:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=YbQBpv4whoNeicgiApWc9qUTbUxQZm0pHjjPOxHAX5c=; b=oOh+yTOw7UIDQwbQcrtzX1EAVJuZSjKG/hp2igJ3OmE88UC+BJ3hrTLDmOqr+1xlT5 LMjALAKp6ckJcdUuWd+xUGVfN00doZK0scFfPiqtBdwpPRGgBAtH2pY1D88XroDzpWSX JrhsI8gqp2sHr9U7+wawcieyjLOua8RISRcd8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=mjva3PyqMinFe6Iujf5Xmho5faY95SYWB5VYtNJJek4Pdc1+YWT1NLy50R2/xYdBGU wCNalvfXheEyRfy6rnXejHYvR3Vi1m8+KKVsmwozEpeS2MgUIRt7jCxhYllsiJjlCo1x a7VztzSV/VFmOLY49MMUuK0AliEj7aRDg0cyE= MIME-Version: 1.0 Received: by 10.204.74.21 with SMTP id s21mr254665bkj.62.1304452904976; Tue, 03 May 2011 13:01:44 -0700 (PDT) Received: by 10.204.39.133 with HTTP; Tue, 3 May 2011 13:01:44 -0700 (PDT) In-Reply-To: <4DC05D39.4020309@gmail.com> References: <4D3889D2.80508@gmail.com> <201101202043.p0KKhDIB076736@lurza.secnetix.de> <4DBF0D26.8020703@gmail.com> <4DC0513A.5000805@gmail.com> <4DC0563D.7080005@gmail.com> <4DC05D39.4020309@gmail.com> Date: Tue, 3 May 2011 13:01:44 -0700 Message-ID: From: Maksim Yevmenkin To: David Demelier Content-Type: multipart/mixed; boundary=0016e6d7e82607013c04a2649c0f Cc: freebsd-bluetooth@freebsd.org Subject: Re: Bluetooth mouse does not connect after reboot X-BeenThere: freebsd-bluetooth@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Using Bluetooth in FreeBSD environments List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2011 20:01:46 -0000 --0016e6d7e82607013c04a2649c0f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Tue, May 3, 2011 at 12:53 PM, David Demelier wrote: > On 03/05/2011 21:36, Maksim Yevmenkin wrote: >> >> On Tue, May 3, 2011 at 12:23 PM, David Demelier >> =A0wrote: >>>>>>> >>>>>>> I'm sorry to disturb you again.. I'm still guessin where to search >>>>>>> how >>>>>>> to >>>>>>> get these horizontal events with my bluetooth mouse. I thing the >>>>>>> mouse_info >>>>>>> structure does not need to be extended I have a USB mouse that has >>>>>>> the >>>>>>> same >>>>>>> horizontal buttons and they just works ! >>>>>>> >>>>>>> They sends 7 and 8 events to X (checked with xev) >>>>>>> >>>>>>> What can I do to extend bthidd and this button support ? >>>>>> >>>>>> like i said before, you need to decode AC_Pan data from the report. = i >>>>>> just took a quick look at ums(4) driver and, it appears, that AC_Pan >>>>>> events are translated into button events, i.e. values< =A0 =A0 =A00 = is mask >>>>>> (1 >>>>>> << =A0 =A0 =A03) and values> =A0 =A0 =A00 is mask (1<< =A0 =A0 =A04)= . you can add >>>>>> identical >>>>>> translation to bthidd(8) to see if it works. you will need to modify >>>>>> hid_interrupt() function in hid.c >>>>> >>>>> Max, >>>>> >>>>> I successfully made the patch but it's not the same mask. This diff >>>>> just >>>>> works! >>>>> >>>>> --- hid.c.orig =A02011-05-02 22:09:48.000000000 +0200 >>>>> +++ hid.c =A0 =A0 =A0 2011-05-03 20:57:46.000000000 +0200 >>>>> @@ -168,6 +168,16 @@ >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0usage =3D HID_USAGE(h.usage); >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0val =3D hid_get_data(data,&h); >>>>> >>>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Horizontal buttons */ >>>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (page =3D=3D HUP_CONSUMER&& =A0 =A0u= sage =3D=3D HUC_AC_PAN) { >>>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (val< =A0 =A00) >>>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mouse_b= utt |=3D (1<< =A0 =A05); >>>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 else if (val> =A0 =A00) >>>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mouse_b= utt |=3D (1<< =A0 =A06); >>>>> + >>>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mevents ++; >>>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>>>> + >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0switch (page) { >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0case HUP_GENERIC_DESKTOP: >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0switch (usage) { >>>>> >>>>> Do you think it's a diff suitable to commit ? >>>>> >>>>> I'm so happy to make my horizontal buttons working :):) >>>> >>>> ah, i see you already figured it out :) i can commit something like >>>> this, i suppose. i would just move the statement into switch() below. >>>> i suppose we could just document that ac_pan is encoded as 8 and 9 >>>> button presses. >>>> >>> >>> Yes but why is the mask different from the ums ones ? Also can you comm= it >>> this to -STABLE thus I'll be able to use it without patching it. >> >> i *think* its because usb mouse operates on level1 (see mouse(4) for >> details), and, status for "extended" mouse buttons reported >> separately, i.e. from mouse(4) man page: byte 8, bits 0-6 reflect the >> state of the buttons 4-10. >> >> i can not commit this directly to -stable. i need to commit this to >> -head first and then mfc it after a week or so. >> >> i'm attaching a slightly different patch (dont worry you still get all >> the credit). please try it and let me know if it works for you. >> > Yes, this is what I was trying to do before putting it outside the switch= () > statement because of these warning in /var/log/messages : > > May =A03 21:52:21 Melon bthidd[25785]: Keyboard events received from > non-keyboard device 00:1f:20:0f:62:31. Please report > > These messages appears after pressing these buttons. argh.... sorry... please try attached patch thanks max --0016e6d7e82607013c04a2649c0f Content-Type: text/plain; charset=US-ASCII; name="bthidd.diff.txt" Content-Disposition: attachment; filename="bthidd.diff.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gn99kmk80 SW5kZXg6IGhpZC5jCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIGhpZC5jCShyZXZpc2lvbiAyMjE0MDApCisrKyBo aWQuYwkod29ya2luZyBjb3B5KQpAQCAtMjI5LDYgKzIyOSwxNyBAQAogCQkJCWJyZWFrOwogCiAJ CQlzd2l0Y2ggKHVzYWdlKSB7CisJCQljYXNlIEhVQ19BQ19QQU46CisJCQkJLyogSG9yaXpvbnRh bCBzY3JvbGwgKi8KKwkJCQlpZiAodmFsIDwgMCkKKwkJCQkJbW91c2VfYnV0dCB8PSAoMSA8PCA1 KTsKKwkJCQllbHNlCisJCQkJCW1vdXNlX2J1dHQgfD0gKDEgPDwgNik7CisKKwkJCQltZXZlbnRz ICsrOworCQkJCXZhbCA9IDA7CisJCQkJYnJlYWs7CisKIAkJCWNhc2UgMHhiNTogLyogU2NhbiBO ZXh0IFRyYWNrICovCiAJCQkJdmFsID0gMHgxOTsKIAkJCQlicmVhazsK --0016e6d7e82607013c04a2649c0f--