From owner-freebsd-mobile@FreeBSD.ORG Tue Jun 17 13:02:32 2014 Return-Path: Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D30BAA6A for ; Tue, 17 Jun 2014 13:02:32 +0000 (UTC) Received: from nm46-vm7.bullet.mail.bf1.yahoo.com (nm46-vm7.bullet.mail.bf1.yahoo.com [216.109.115.110]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81D832D25 for ; Tue, 17 Jun 2014 13:02:32 +0000 (UTC) Received: from [66.196.81.174] by nm46.bullet.mail.bf1.yahoo.com with NNFMP; 17 Jun 2014 12:59:28 -0000 Received: from [68.142.230.76] by tm20.bullet.mail.bf1.yahoo.com with NNFMP; 17 Jun 2014 12:59:28 -0000 Received: from [127.0.0.1] by smtp233.mail.bf1.yahoo.com with NNFMP; 17 Jun 2014 12:59:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1403009968; bh=A4743wwdBaw6TWh7Qqpo5cZI3su6MZh7Gis1VkZGPQM=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=zfb202WjUMiTGC7oBLztEyeGNMHmzX0dQQZTJec7QO31qyBU3EcbPwtW8HMhqxy41MdkUStRZ/RnptSuRNzX5D+SXkvJX+bMp079tYHRN7IkGYSEGSKk5nurM5inuIP3HuTdHN2lEOwUVmPmNC5wzzm2WYXHuPiyI1rDWcdLMwU= X-Yahoo-Newman-Id: 466946.98085.bm@smtp233.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: RTZ1CQAVM1mKNm4jemQgN6fj5slO3aqf.uxJnlmioG9pwMB wV7yGcMbeTiwjRz0HeNheXpoPsy21q04jYG9SBCu6lEzDNU0vUbwS35_mgo9 BLZ3FSq1f5ccTsvv6OImJRqiquez0k73jlSaoU4y_F_CxcTUM7Vb9NC8UkU0 45SxFgziE4kUU02nM5rTSKeJA6ZYdc1nKgs899eDx84ei9gOn1dZ50eG5IiT 6yoiiPi8yF3n4Jepp26CJ5p4MdyO40igPi_gYaFxFf2yCTkMsRxPGPU12y.o 7Ep9btWgrGH6O6_AboKR5TBz.KGeCr6eVVQJXle2.LPda.N.ufMsLpW81DRJ nJ4pMeY0PD6fNcywyKQ.CtNmPDfISrWLB45g7mHesISCUQ41dUKYEH61IwJm tIp_xcbd31uDZe94A6_qpnr1f2ZA.XwenV0OaDIU7FORZMlsUdiPFX5MB.Ds Z.PglGiLszRL13gRYGQ62Y5khESYetJqAHhNOwuVCwgX1RRHv1snp109sSDB ZiNKRejCY8JK4okc9m3JRdDZICq9CQLYLwA-- X-Yahoo-SMTP: 9sPoSQ2swBBlERuQ.0vs8XLc_MeClW0- X-Rocket-Received: from [10.82.217.243] (Scoobi_doo@64.102.254.34 with plain [98.139.211.125]) by smtp233.mail.bf1.yahoo.com with SMTP; 17 Jun 2014 12:59:28 +0000 UTC Message-ID: <53A03BAF.3020807@yahoo.com> Date: Tue, 17 Jun 2014 08:59:27 -0400 From: Anthony Jenkins User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Eric McCorkle , Ivan Rokotov Subject: [Patch] psm(4) ClickPad detection (was Re: Lenovo W540 so far) References: <539DA73B.7050709@metricspace.net> <1402931204.35984.YahooMailNeo@web140703.mail.bf1.yahoo.com> <58DCAA2E-44DA-48F3-87B3-366301F55138@metricspace.net> <53A02532.60201@metricspace.net> In-Reply-To: <53A02532.60201@metricspace.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: "freebsd-mobile@freebsd.org" X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jun 2014 13:02:32 -0000 On 06/17/2014 07:23, Eric McCorkle wrote: > Thanks again. That did it. The touchpad is now completely working :D > > Only thing is it seems you can't use it along with moused/sysmouse. I assume this is because whatever protocol moused speaks is pre-multitouch. > > I suppose that would also mean that you couldn't plug in a USB mouse and have it just work with this setup. This also seems to keep the trackpoint from working (not that I ever use it...) > > On 06/16/2014 19:21, Ivan Rokotov wrote: >> 2014-06-16 21:41 GMT+02:00 Eric McCorkle : >>> There's no virtual scrolling though. Has that been added to the driver yet, >>> or am I missing some config items? >> >> Eric, what do you mean by virtual scrolling? In my case, two-finger >> scrolling and edge scrolling are working (both horizontal and >> vertical). >> >> Option "VertEdgeScroll" "on" >> Option "HorizEdgeScroll" "on" >> Option "VertTwoFingerScroll" "1" >> Option "HorizTwoFingerScroll" "1" >> Option "VertScrollDelta" "-50" >> Option "HorizScrollDelta" "-60" >> >> (minus is for mac-style 'natural scrolling'). >> >> Or you mean something else? >> Ivan >> The moused/sysmouse bit is what I was going to work on first. I used to have patches to sysutils/hald and x11-drivers/xf86-input-synaptics that would check moused(8) to see if Synaptics functionality was enabled and report the input device as a "touchpad" rather than a "mouse", which would allow the Synaptics driver to load. The move from hald to our homebrew device detection code means I have to re-learn how to do this. In the meantime, I did manage to patch psm(4) to at least detect a ClickPad (and some other properties we weren't detecting). No idea if it'd make a difference to software higher up; it'd have to know about the new struct fields I added. I'm also pretty sure I'd have to add code to handle the ClickPad clicks and report it as an additional button. Patch /shouldn't/ represent an ABA change because I stuck the additional fields at the end of the synapticshw_t struct and advertise/guard their availability with a HAS_EXT_0C_CAPS macro, but I'm new to submitting driver patches...anyway it's not ready yet, just showing I'm workin' on it :-) [root@ajenkins-hplaptop /usr/src]# svn diff sys/sys/mouse.h sys/dev/atkbdc/psm.c Index: sys/sys/mouse.h =================================================================== --- sys/sys/mouse.h (revision 267519) +++ sys/sys/mouse.h (working copy) @@ -49,6 +49,7 @@ #endif #define MOUSE_SYN_GETHWINFO _IOR('M', 100, synapticshw_t) +#define HAS_EXT_0C_CAPS 1 /* mouse status block */ typedef struct mousestatus { @@ -110,6 +111,16 @@ int capMiddle; int nExtendedButtons; int nExtendedQueries; +#ifdef HAS_EXT_0C_CAPS + /* Extended (0x0c query) capabilities */ + int capClickPad; + int capClickPad2Btn; + int capMaxDimensions; + int capMinDimensions; + int capAdvGesture; + int capReducedFiltering; + int capImageSensor; +#endif } synapticshw_t; /* iftype */ Index: sys/dev/atkbdc/psm.c =================================================================== --- sys/dev/atkbdc/psm.c (revision 267519) +++ sys/dev/atkbdc/psm.c (working copy) @@ -3623,20 +3623,13 @@ static int mouse_ext_command(KBDC kbdc, int command) { - int c; + int c, i; - c = (command >> 6) & 0x03; - if (set_mouse_resolution(kbdc, c) != c) - return (FALSE); - c = (command >> 4) & 0x03; - if (set_mouse_resolution(kbdc, c) != c) - return (FALSE); - c = (command >> 2) & 0x03; - if (set_mouse_resolution(kbdc, c) != c) - return (FALSE); - c = (command >> 0) & 0x03; - if (set_mouse_resolution(kbdc, c) != c) - return (FALSE); + for (i = 6; i >= 0; i -= 2) { + c = (command >> i) & 0x03; + if (set_mouse_resolution(kbdc, c) != c) + return (FALSE); + } return (TRUE); } @@ -4470,7 +4463,7 @@ buttons = 0; synhw.capExtended = (status[0] & 0x80) != 0; if (synhw.capExtended) { - synhw.nExtendedQueries = (status[0] & 0x70) != 0; + synhw.nExtendedQueries = (status[0] & 0x70) >> 4; synhw.capMiddle = (status[0] & 0x04) != 0; synhw.capPassthrough = (status[2] & 0x80) != 0; synhw.capSleep = (status[2] & 0x10) != 0; @@ -4480,15 +4473,19 @@ if (verbose >= 2) { printf(" Extended capabilities:\n"); - printf(" capExtended: %d\n", synhw.capExtended); - printf(" capMiddle: %d\n", synhw.capMiddle); + printf(" capExtended: %d\n", synhw.capExtended); + printf(" capMiddle: %d\n", synhw.capMiddle); printf(" nExtendedQueries: %d\n", synhw.nExtendedQueries); - printf(" capPassthrough: %d\n", synhw.capPassthrough); - printf(" capSleep: %d\n", synhw.capSleep); - printf(" capFourButtons: %d\n", synhw.capFourButtons); - printf(" capMultiFinger: %d\n", synhw.capMultiFinger); - printf(" capPalmDetect: %d\n", synhw.capPalmDetect); + printf(" capPassthrough: %d\n", + synhw.capPassthrough); + printf(" capSleep: %d\n", synhw.capSleep); + printf(" capFourButtons: %d\n", + synhw.capFourButtons); + printf(" capMultiFinger: %d\n", + synhw.capMultiFinger); + printf(" capPalmDetect: %d\n", + synhw.capPalmDetect); } /* @@ -4496,7 +4493,7 @@ * supports this number of extended queries. We can load * more information about buttons using query 0x09. */ - if (synhw.capExtended && synhw.nExtendedQueries) { + if (synhw.capExtended && synhw.nExtendedQueries >= 1) { if (mouse_ext_command(kbdc, 0x09) == 0) return (FALSE); if (get_mouse_status(kbdc, status, 0, 3) != 3) @@ -4508,12 +4505,45 @@ * if capMiddle support bit is set. */ buttons = synhw.nExtendedButtons + synhw.capMiddle; - } else + } else { /* * If the capFourButtons support bit is set, * add a fourth button to the total button count. */ buttons = synhw.capFourButtons ? 1 : 0; + } +#ifdef HAS_EXT_0C_CAPS + if (synhw.capExtended && synhw.nExtendedQueries >= 4) { + if (mouse_ext_command(kbdc, 0x0c) == 0) + return (FALSE); + if (get_mouse_status(kbdc, status, 0, 3) != 3) + return (FALSE); + synhw.capClickPad = (status[0] & 0x10) != 0; + synhw.capClickPad2Btn = (status[1] & 0x01) != 0; + synhw.capMaxDimensions = (status[0] & 0x02) != 0; + synhw.capMinDimensions = (status[1] & 0x20) != 0; + synhw.capAdvGesture = (status[0] & 0x08) != 0; + synhw.capReducedFiltering = (status[1] & 0x04) != 0; + synhw.capImageSensor = (status[1] & 0x08) != 0; + if (verbose >= 2) { + printf(" Extended capabilities (0x0c query):\n"); + printf(" capClickPad: %d\n", + synhw.capClickPad); + printf(" capClickPad2Btn: %d\n", + synhw.capClickPad2Btn); + printf(" capMaxDimensions: %d\n", + synhw.capMaxDimensions); + printf(" capMinDimensions: %d\n", + synhw.capMinDimensions); + printf(" capAdvGesture: %d\n", + synhw.capAdvGesture); + printf(" capReducedFiltering: %d\n", + synhw.capReducedFiltering); + printf(" capImageSensor: %d\n", + synhw.capImageSensor); + } + } +#endif /* HAS_EXT_0C_CAPS */ } if (verbose >= 2) { if (synhw.capExtended)