Re: Apple Trackpad driver

2014-02-04 Thread Hans Petter Selasky

On 02/01/14 08:18, Hans Petter Selasky wrote:

On 02/01/14 08:07, Hans Petter Selasky wrote:

On 01/31/14 21:30, Danilo E. Gondolfo wrote:

I noticed that your driver is based on the Linux driver [1] and some
pieces of code are copied, are you sure that we won't have any problems
with license?





Hi,

If the Linux guys think this is a big problem, we can support this
hardware through /usr/ports/multimedia/webcamd, quite easily. Although a
kernel driver would be best for this type of device.

Thank you!


FYI

Feedback from Greg: "That's great to hear, nice job!"

--HPS
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Apple Trackpad driver

2014-01-31 Thread Hans Petter Selasky

On 02/01/14 08:07, Hans Petter Selasky wrote:

On 01/31/14 21:30, Danilo E. Gondolfo wrote:

I noticed that your driver is based on the Linux driver [1] and some
pieces of code are copied, are you sure that we won't have any problems
with license?


Hi,

Hence Huang has only copied so-called "header file contents", I think
this should be fine. I've anyhow added a notice about that. I'll clear
any issues directly with Greg Kroah-Hartman. The GPLv2 is clear that
such contents is so-called "unrestricted". Se chapter 5.

Regarding the parts re-used from existing FreeBSD input drivers, this is
the way we should write drivers, by trying to re-use existing well
written and working device drivers. What Huang has done is perfectly
fine with with me.

http://svnweb.freebsd.org/changeset/base/261343

--HPS


Hi,

If the Linux guys think this is a big problem, we can support this 
hardware through /usr/ports/multimedia/webcamd, quite easily. Although a 
kernel driver would be best for this type of device.


Thank you!

--HPS
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Apple Trackpad driver

2014-01-31 Thread Hans Petter Selasky

On 01/31/14 21:30, Danilo E. Gondolfo wrote:

I noticed that your driver is based on the Linux driver [1] and some
pieces of code are copied, are you sure that we won't have any problems
with license?


Hi,

Hence Huang has only copied so-called "header file contents", I think 
this should be fine. I've anyhow added a notice about that. I'll clear 
any issues directly with Greg Kroah-Hartman. The GPLv2 is clear that 
such contents is so-called "unrestricted". Se chapter 5.


Regarding the parts re-used from existing FreeBSD input drivers, this is 
the way we should write drivers, by trying to re-use existing well 
written and working device drivers. What Huang has done is perfectly 
fine with with me.


http://svnweb.freebsd.org/changeset/base/261343

--HPS
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Apple Trackpad driver

2014-01-31 Thread Huang Wen Hui
Hi,
I tried to add to support modem macbooks into atp(4) at the beginning, but
realized that atp(4) is
very different from new touchpad hardware, so I give up, I think some one
can do that.

Cheers,

Huang Wen Hui


2014-02-01 Danilo E. Gondolfo :

> On 01/31/14 21:45, 黄文辉@Gmail wrote:
> > Hi Hans,
> > Yes,  I wrote wsp base on atp(4) and bcm5974.c from Linux. Of course we
> can add a notice about that. Table and some structure bt_data, tp_finger
> from Linux, I only wrote wsp_intr_callback base on usbdump, all other part
> should be belong to Hans.
> >
> > Cheers,
> >
> > Huang Wen Hui
> >
> >> 在 2014年2月1日,6:49,Hans Petter Selasky  写道:
> >>
> >>> On 01/31/14 21:30, Danilo E. Gondolfo wrote:
>  On 01/31/14 05:16, Hans Petter Selasky wrote:
> > On 01/31/14 02:46, Huang Wen Hui wrote:
> > Hi Hans,
> >
> > pos_x[] is not non-inialized,  it may be previous pos_x, it is still
> > ok for
> > getting dx.
> > "n" var is trying to reduce "untouch" sensor data for post
> > proccessing. I
> > attach a new patch
> > may be more clear, also fixed unexpected movement when button status
> or
> > ntouch changing.
> >
> > Cheers,
> >
> > Huang Wen Hui
>  Hi,
> 
>  http://svnweb.freebsd.org/changeset/base/261315
> 
>  --HPS
> >>> Good work!
> >>>
> >>> I noticed that your driver is based on the Linux driver [1] and some
> >>> pieces of code are copied, are you sure that we won't have any problems
> >>> with license?
> >>>
> >>> These changes can be (should be) merged in the driver atp(4), no?
> >>>
> >>> Danilo.
> >>>
> >>>
> >>> [1] -
> http://lxr.free-electrons.com/source/drivers/input/mouse/bcm5974.c
> >> Hi,
> >>
> >> It looks to me like some tables have been copied. We probably should
> add a notice about that. The rest of the code looks OK to me.
> >>
> >> Huang, any comments?
> >>
> >> --HPS
> >>
> >
>
> Hello,
>
> And what about keeping these two driver? (atp and wsp)
> Both has the same purpose. Wouldn't be better merge the new code on atp?
>
> On freebsd-drivers@ the author of the atp driver started a thread about
> this [1].
>
> Danilo.
>
> [1] -
> http://lists.freebsd.org/pipermail/freebsd-drivers/2014-January/001659.html
> ___
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
>
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: Apple Trackpad driver

2014-01-31 Thread Danilo E. Gondolfo
On 01/31/14 21:45, 黄文辉@Gmail wrote:
> Hi Hans,
> Yes,  I wrote wsp base on atp(4) and bcm5974.c from Linux. Of course we can 
> add a notice about that. Table and some structure bt_data, tp_finger from 
> Linux, I only wrote wsp_intr_callback base on usbdump, all other part should 
> be belong to Hans.
>
> Cheers,
>
> Huang Wen Hui
>
>> 在 2014年2月1日,6:49,Hans Petter Selasky  写道:
>>
>>> On 01/31/14 21:30, Danilo E. Gondolfo wrote:
 On 01/31/14 05:16, Hans Petter Selasky wrote:
> On 01/31/14 02:46, Huang Wen Hui wrote:
> Hi Hans,
>
> pos_x[] is not non-inialized,  it may be previous pos_x, it is still
> ok for
> getting dx.
> "n" var is trying to reduce "untouch" sensor data for post
> proccessing. I
> attach a new patch
> may be more clear, also fixed unexpected movement when button status or
> ntouch changing.
>
> Cheers,
>
> Huang Wen Hui
 Hi,

 http://svnweb.freebsd.org/changeset/base/261315

 --HPS
>>> Good work!
>>>
>>> I noticed that your driver is based on the Linux driver [1] and some
>>> pieces of code are copied, are you sure that we won't have any problems
>>> with license?
>>>
>>> These changes can be (should be) merged in the driver atp(4), no?
>>>
>>> Danilo.
>>>
>>>
>>> [1] - http://lxr.free-electrons.com/source/drivers/input/mouse/bcm5974.c
>> Hi,
>>
>> It looks to me like some tables have been copied. We probably should add a 
>> notice about that. The rest of the code looks OK to me.
>>
>> Huang, any comments?
>>
>> --HPS
>>
>

Hello,

And what about keeping these two driver? (atp and wsp)
Both has the same purpose. Wouldn't be better merge the new code on atp?

On freebsd-drivers@ the author of the atp driver started a thread about
this [1].

Danilo.

[1] -
http://lists.freebsd.org/pipermail/freebsd-drivers/2014-January/001659.html
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: Apple Trackpad driver

2014-01-31 Thread 黄文辉@Gmail
Hi Hans,
Yes,  I wrote wsp base on atp(4) and bcm5974.c from Linux. Of course we can add 
a notice about that. Table and some structure bt_data, tp_finger from Linux, I 
only wrote wsp_intr_callback base on usbdump, all other part should be belong 
to Hans.

Cheers,

Huang Wen Hui

> 在 2014年2月1日,6:49,Hans Petter Selasky  写道:
> 
>> On 01/31/14 21:30, Danilo E. Gondolfo wrote:
>>> On 01/31/14 05:16, Hans Petter Selasky wrote:
 On 01/31/14 02:46, Huang Wen Hui wrote:
 Hi Hans,
 
 pos_x[] is not non-inialized,  it may be previous pos_x, it is still
 ok for
 getting dx.
 "n" var is trying to reduce "untouch" sensor data for post
 proccessing. I
 attach a new patch
 may be more clear, also fixed unexpected movement when button status or
 ntouch changing.
 
 Cheers,
 
 Huang Wen Hui
>>> 
>>> Hi,
>>> 
>>> http://svnweb.freebsd.org/changeset/base/261315
>>> 
>>> --HPS
>> 
>> Good work!
>> 
>> I noticed that your driver is based on the Linux driver [1] and some
>> pieces of code are copied, are you sure that we won't have any problems
>> with license?
>> 
>> These changes can be (should be) merged in the driver atp(4), no?
>> 
>> Danilo.
>> 
>> 
>> [1] - http://lxr.free-electrons.com/source/drivers/input/mouse/bcm5974.c
> 
> Hi,
> 
> It looks to me like some tables have been copied. We probably should add a 
> notice about that. The rest of the code looks OK to me.
> 
> Huang, any comments?
> 
> --HPS
> 
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: Apple Trackpad driver

2014-01-31 Thread Hans Petter Selasky

On 01/31/14 21:30, Danilo E. Gondolfo wrote:

On 01/31/14 05:16, Hans Petter Selasky wrote:

On 01/31/14 02:46, Huang Wen Hui wrote:

Hi Hans,

pos_x[] is not non-inialized,  it may be previous pos_x, it is still
ok for
getting dx.
"n" var is trying to reduce "untouch" sensor data for post
proccessing. I
attach a new patch
may be more clear, also fixed unexpected movement when button status or
ntouch changing.

Cheers,

Huang Wen Hui


Hi,

http://svnweb.freebsd.org/changeset/base/261315

--HPS



Good work!

I noticed that your driver is based on the Linux driver [1] and some
pieces of code are copied, are you sure that we won't have any problems
with license?

These changes can be (should be) merged in the driver atp(4), no?

Danilo.


[1] - http://lxr.free-electrons.com/source/drivers/input/mouse/bcm5974.c


Hi,

It looks to me like some tables have been copied. We probably should add 
a notice about that. The rest of the code looks OK to me.


Huang, any comments?

--HPS

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Apple Trackpad driver

2014-01-31 Thread Danilo E. Gondolfo
On 01/31/14 05:16, Hans Petter Selasky wrote:
> On 01/31/14 02:46, Huang Wen Hui wrote:
>> Hi Hans,
>>
>> pos_x[] is not non-inialized,  it may be previous pos_x, it is still
>> ok for
>> getting dx.
>> "n" var is trying to reduce "untouch" sensor data for post
>> proccessing. I
>> attach a new patch
>> may be more clear, also fixed unexpected movement when button status or
>> ntouch changing.
>>
>> Cheers,
>>
>> Huang Wen Hui
>
> Hi,
>
> http://svnweb.freebsd.org/changeset/base/261315
>
> --HPS
>

Good work!

I noticed that your driver is based on the Linux driver [1] and some
pieces of code are copied, are you sure that we won't have any problems
with license?

These changes can be (should be) merged in the driver atp(4), no?

Danilo.


[1] - http://lxr.free-electrons.com/source/drivers/input/mouse/bcm5974.c
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Apple Trackpad driver

2014-01-30 Thread Hans Petter Selasky

On 01/31/14 02:46, Huang Wen Hui wrote:

Hi Hans,

pos_x[] is not non-inialized,  it may be previous pos_x, it is still ok for
getting dx.
"n" var is trying to reduce "untouch" sensor data for post proccessing. I
attach a new patch
may be more clear, also fixed unexpected movement when button status or
ntouch changing.

Cheers,

Huang Wen Hui


Hi,

http://svnweb.freebsd.org/changeset/base/261315

--HPS

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Apple Trackpad driver

2014-01-30 Thread Huang Wen Hui
Hi Hans,

pos_x[] is not non-inialized,  it may be previous pos_x, it is still ok for
getting dx.
"n" var is trying to reduce "untouch" sensor data for post proccessing. I
attach a new patch
may be more clear, also fixed unexpected movement when button status or
ntouch changing.

Cheers,

Huang Wen Hui

2014-01-30 Hans Petter Selasky :

> Hi Huang,
>
>
> On 01/30/14 06:56, Huang Wen Hui wrote:
>
>> Hans,
>>
>> Thanks for you take care of it and commit it! I found two problems:
>>
>> 1. The selection is not expected when selection with 2 fingers sometimes.
>> 2.  Unexpected scrolling when Click with 2 fingers.
>>
>> This patch can fix that. The var "n" modify to "ntouch"  seems to be
>> necessary.
>>
>>
> Right, but aren't we then accessing non-initialised sc->pos_x[] data ?
>
> Because if ntouch == 2, n can be less than or equal to 2, due to continue
> in for-loop above. What is the purpose of the "n" variable?
>
> Can you explain?
>
> -   if (n == 2) {
> +   if (ntouch == 2) {
> sc->distance = max(sc->distance, max(
> abs(sc->pos_x[0] - sc->pos_x[1]),
> abs(sc->pos_y[0] - sc->pos_y[1])));
>
> --HPS
>
>
>> Cheers,
>> Huang Wen Hui
>>
>>
>> 2014-01-29 Hans Petter Selasky 
>>
>>  On 01/29/14 09:49, Lundberg, Johannes wrote:
>>>
>>>  Hi

 I tested the driver on a 2012 Macbook Air 11" and it works great! Good
 job!

 Is there a way to disable click-by-touch? I always preferred clicking
 with
 the physical button that is built in to the pad.


  Hi,
>>>
>>> I've added an "#if 0" around the 1 finger tap code until further. Maybe
>>> this feature can be tunable?
>>>
>>> I fixed the code style, added some range checks and cleared some buffer
>>> issues.
>>>
>>> When you assign a signed value to an unsigned variable, you should range
>>> check it, because the sign might cause an overflow when you use it later
>>> on.
>>>
>>> int8_t x = -1;
>>>
>>> uint32_t t = x;
>>>
>>> "t" is now "0xU" and not "255".
>>>
>>> Tested the code on my MacBookPro. Hope I didn't break anything. If so,
>>> send a patch to freebsd-usb.
>>>
>>> http://svnweb.freebsd.org/changeset/base/261260
>>>
>>> To get the touchpad working with Xorg, I needed to re-compile HALD with
>>> the attached patch.
>>>
>>> kwm: Can you get the attached patch into ports?
>>>
>>> Auto-loading of wsp via devd will be done later. Simply need to
>>> re-generate usb.conf in /etc ...
>>>
>>> --HPS
>>>
>>>
>>>
>>>
>>> ___
>>> freebsd-current@freebsd.org mailing list
>>> http://lists.freebsd.org/mailman/listinfo/freebsd-current
>>> To unsubscribe, send any mail to "freebsd-current-unsubscribe@
>>> freebsd.org"
>>>
>>
>
--- wsp.c.orig  2014-01-30 08:14:26.0 +0800
+++ wsp.c   2014-01-31 09:44:02.0 +0800
@@ -605,7 +605,8 @@
int dz_count;
 #defineWSP_DZ_MAX_COUNT32
int dt_sum; /* T-axis cumulative movement */
-
+   
+   uint8_t o_ntouch;   /* old touch finger status */
uint8_t finger; /* 0 or 1 *, check which finger moving 
*/
uint16_t intr_count;
 #defineWSP_TAP_THRESHOLD   3
@@ -871,7 +872,6 @@
int dx = 0;
int dy = 0;
int dz = 0;
-   int n = 0;
int len;
int i;
 
@@ -936,13 +936,9 @@
f[i].tool_major, f[i].tool_minor, f[i].orientation,
f[i].touch_major, f[i].touch_minor, f[i].multi);
 
-   if (f[i].touch_major < tun.pressure_untouch_threshold)
-   continue;
-
-   sc->pos_x[n] = f[i].abs_x;
-   sc->pos_y[n] = params->y.min + params->y.max - 
f[i].abs_y;
-   sc->index[n] = &f[i];
-   n++;
+   sc->pos_x[i] = f[i].abs_x;
+   sc->pos_y[i] = params->y.min + params->y.max - 
f[i].abs_y;
+   sc->index[i] = &f[i];
}
 
sc->sc_status.flags &= ~MOUSE_POSCHANGED;
@@ -957,8 +953,8 @@
if (h->q2 == 4)
sc->intr_count++;
 
-   if (sc->ntaps < n) {
-   switch (n) {
+   if (sc->ntaps < ntouch) {
+   switch (ntouch) {
case 1:
if (f[0].touch_major > 
tun.pressure_tap_threshold)
sc->ntaps = 1;
@@ -978,7 +974,7 @@
break;
}
}
-   if (n == 2) {
+   if (ntouch == 2) {
sc->distance = max(sc->distance, max(
abs(sc->pos_x[0] - sc->pos_x[1]),
abs(sc->pos_y[0] - sc->pos_y[1])));
@@ -1050,15 +1

Re: Apple Trackpad driver

2014-01-29 Thread Hans Petter Selasky

Hi Huang,

On 01/30/14 06:56, Huang Wen Hui wrote:

Hans,

Thanks for you take care of it and commit it! I found two problems:

1. The selection is not expected when selection with 2 fingers sometimes.
2.  Unexpected scrolling when Click with 2 fingers.

This patch can fix that. The var "n" modify to "ntouch"  seems to be
necessary.



Right, but aren't we then accessing non-initialised sc->pos_x[] data ?

Because if ntouch == 2, n can be less than or equal to 2, due to 
continue in for-loop above. What is the purpose of the "n" variable?


Can you explain?

-   if (n == 2) {
+   if (ntouch == 2) {
sc->distance = max(sc->distance, max(
abs(sc->pos_x[0] - sc->pos_x[1]),
abs(sc->pos_y[0] - sc->pos_y[1])));

--HPS



Cheers,
Huang Wen Hui


2014-01-29 Hans Petter Selasky 


On 01/29/14 09:49, Lundberg, Johannes wrote:


Hi

I tested the driver on a 2012 Macbook Air 11" and it works great! Good
job!

Is there a way to disable click-by-touch? I always preferred clicking with
the physical button that is built in to the pad.



Hi,

I've added an "#if 0" around the 1 finger tap code until further. Maybe
this feature can be tunable?

I fixed the code style, added some range checks and cleared some buffer
issues.

When you assign a signed value to an unsigned variable, you should range
check it, because the sign might cause an overflow when you use it later on.

int8_t x = -1;

uint32_t t = x;

"t" is now "0xU" and not "255".

Tested the code on my MacBookPro. Hope I didn't break anything. If so,
send a patch to freebsd-usb.

http://svnweb.freebsd.org/changeset/base/261260

To get the touchpad working with Xorg, I needed to re-compile HALD with
the attached patch.

kwm: Can you get the attached patch into ports?

Auto-loading of wsp via devd will be done later. Simply need to
re-generate usb.conf in /etc ...

--HPS




___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Apple Trackpad driver

2014-01-29 Thread Huang Wen Hui
Hans,

Thanks for you take care of it and commit it! I found two problems:

1. The selection is not expected when selection with 2 fingers sometimes.
2.  Unexpected scrolling when Click with 2 fingers.

This patch can fix that. The var "n" modify to "ntouch"  seems to be
necessary.


Cheers,
Huang Wen Hui


2014-01-29 Hans Petter Selasky 

> On 01/29/14 09:49, Lundberg, Johannes wrote:
>
>> Hi
>>
>> I tested the driver on a 2012 Macbook Air 11" and it works great! Good
>> job!
>>
>> Is there a way to disable click-by-touch? I always preferred clicking with
>> the physical button that is built in to the pad.
>>
>>
> Hi,
>
> I've added an "#if 0" around the 1 finger tap code until further. Maybe
> this feature can be tunable?
>
> I fixed the code style, added some range checks and cleared some buffer
> issues.
>
> When you assign a signed value to an unsigned variable, you should range
> check it, because the sign might cause an overflow when you use it later on.
>
> int8_t x = -1;
>
> uint32_t t = x;
>
> "t" is now "0xU" and not "255".
>
> Tested the code on my MacBookPro. Hope I didn't break anything. If so,
> send a patch to freebsd-usb.
>
> http://svnweb.freebsd.org/changeset/base/261260
>
> To get the touchpad working with Xorg, I needed to re-compile HALD with
> the attached patch.
>
> kwm: Can you get the attached patch into ports?
>
> Auto-loading of wsp via devd will be done later. Simply need to
> re-generate usb.conf in /etc ...
>
> --HPS
>
>
--- wsp.c.orig  2014-01-30 08:14:26.0 +0800
+++ wsp.c   2014-01-30 13:49:59.0 +0800
@@ -957,8 +957,8 @@
if (h->q2 == 4)
sc->intr_count++;
 
-   if (sc->ntaps < n) {
-   switch (n) {
+   if (sc->ntaps < ntouch) {
+   switch (ntouch) {
case 1:
if (f[0].touch_major > 
tun.pressure_tap_threshold)
sc->ntaps = 1;
@@ -978,7 +978,7 @@
break;
}
}
-   if (n == 2) {
+   if (ntouch == 2) {
sc->distance = max(sc->distance, max(
abs(sc->pos_x[0] - sc->pos_x[1]),
abs(sc->pos_y[0] - sc->pos_y[1])));
@@ -1050,12 +1050,20 @@
if (sc->sc_touch == WSP_SECOND_TOUCH)
sc->sc_touch = WSP_TOUCHING;
 
-   if (n != 0 &&
+   if (ntouch != 0 &&
h->q2 == 4 &&
f[0].touch_major >= tun.pressure_touch_threshold) {
dx = sc->pos_x[0] - sc->pre_pos_x;
dy = sc->pos_y[0] - sc->pre_pos_y;
-   if (n == 2 && sc->sc_status.button != 0) {
+
+   /* Ignore movement from ibt=1 to ibt=0 */
+   if (sc->sc_status.obutton != 0 && 
+   sc->sc_status.button == 0) {
+   dx = 0;
+   dy = 0;
+   }
+
+   if (ntouch == 2 && sc->sc_status.button != 0) {
dx = sc->pos_x[sc->finger] - 
sc->pre_pos_x;
dy = sc->pos_y[sc->finger] - 
sc->pre_pos_y;
if (f[0].origin == 0 || f[1].origin == 
0) {
@@ -1092,7 +1100,7 @@
sc->dx_sum += dx;
sc->dy_sum += dy;
 
-   if (n == 2 && sc->sc_status.button == 0) {
+   if (ntouch == 2 && sc->sc_status.button == 0) {
if (sc->scr_mode == WSP_SCR_NONE &&
abs(sc->dx_sum) + abs(sc->dy_sum) > 50)
sc->scr_mode = abs(sc->dx_sum) >
@@ -1134,7 +1142,7 @@
sc->pre_pos_x = sc->pos_x[0];
sc->pre_pos_y = sc->pos_y[0];
 
-   if (n == 2 && sc->sc_status.button != 0) {
+   if (ntouch == 2 && sc->sc_status.button != 0) {
sc->pre_pos_x = sc->pos_x[sc->finger];
sc->pre_pos_y = sc->pos_y[sc->finger];
}
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: Apple Trackpad driver

2014-01-29 Thread Mark Felder


On Tue, Jan 28, 2014, at 23:13, Adrian Chadd wrote:
> holy crap, cool!
> 
> Hans? Any chance we could get this into -HEAD?
> 
> 

Wow, this is nice.

I'll gladly provide the USB device ID for the trackpad in the 2013 Late
MBP if someone can point me to a way to boot FreeBSD from an external
drive :-)
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Apple Trackpad driver

2014-01-29 Thread Hans Petter Selasky

Hi,

Can you also write a manual page for the "wsp" driver?

--HPS
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Apple Trackpad driver

2014-01-29 Thread Hans Petter Selasky

On 01/29/14 09:49, Lundberg, Johannes wrote:

Hi

I tested the driver on a 2012 Macbook Air 11" and it works great! Good job!

Is there a way to disable click-by-touch? I always preferred clicking with
the physical button that is built in to the pad.



Hi,

I've added an "#if 0" around the 1 finger tap code until further. Maybe 
this feature can be tunable?


I fixed the code style, added some range checks and cleared some buffer 
issues.


When you assign a signed value to an unsigned variable, you should range 
check it, because the sign might cause an overflow when you use it later on.


int8_t x = -1;

uint32_t t = x;

"t" is now "0xU" and not "255".

Tested the code on my MacBookPro. Hope I didn't break anything. If so, 
send a patch to freebsd-usb.


http://svnweb.freebsd.org/changeset/base/261260

To get the touchpad working with Xorg, I needed to re-compile HALD with 
the attached patch.


kwm: Can you get the attached patch into ports?

Auto-loading of wsp via devd will be done later. Simply need to 
re-generate usb.conf in /etc ...


--HPS

--- patch-hald_freebsd_hf-usb2.c.orig	2014-01-29 11:50:11.0 +0100
+++ patch-hald_freebsd_hf-usb2.c	2014-01-29 11:50:36.0 +0100
@@ -61,7 +61,7 @@
 +			if (driver) {
 +if (!strcmp(driver, "ukbd"))
 +	hf_device_set_input(device, "keyboard", "keys", NULL);
-+else if (!strcmp(driver, "ums") || !strcmp(driver, "atp")) {
++else if (!strcmp(driver, "ums") || !strcmp(driver, "atp") || !strcmp(driver, "wsp")) {
 +	hf_device_set_input(device, "mouse", NULL, devname);
 +	hf_runner_run_sync(device, 0, "hald-probe-mouse", NULL);
 +} else if (!strcmp(driver, "uhid")) {
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: Apple Trackpad driver

2014-01-29 Thread Lundberg, Johannes
Hi

I tested the driver on a 2012 Macbook Air 11" and it works great! Good job!

Is there a way to disable click-by-touch? I always preferred clicking with
the physical button that is built in to the pad.

Best regards

--
Johannes Lundberg
BRILLIANTSERVICE CO., LTD.


On Wed, Jan 29, 2014 at 2:24 PM, Lundberg, Johannes <
johan...@brilliantservice.co.jp> wrote:

> This is really good news :)  I will try it on my 2012 and 2013 MBAs soon!
> (hopefully it is same hardware as in the pros)
>
> --
> Johannes Lundberg
> BRILLIANTSERVICE CO., LTD.
>
>
> On Wed, Jan 29, 2014 at 2:13 PM, Adrian Chadd  wrote:
>
>> holy crap, cool!
>>
>> Hans? Any chance we could get this into -HEAD?
>>
>>
>> -a
>>
>>
>> On 28 January 2014 17:43, Huang Wen Hui  wrote:
>> > Hi,
>> > I have a working trackpad driver  for my MBP 2013, I am not  C
>> programmer
>> > usually,
>> > so the code may ugly. If someone like to test, you can download it from
>> > http://sw.gddsn.org.cn/freebsd/wsp-140129.tar.gz,
>> > I only test it on MBP2012 and MBP2013. Right now the driver have these
>> > feature:
>> >
>> > 1. Vertical scrolling with 2 fingers movement,
>> > 2. In firefox, 2 fingers horizontal movement act as page back/forward.
>> > 3. one finger tap act as left mouse click, 2 fingers tap act as right
>> mouse
>> > click, and
>> > three fingers tap act as middle mouse click.
>> > 4. you also use sysctl to modify some parameters:
>> > hw.usb.wsp.scale_factor: 12
>> > hw.usb.wsp.z_factor: 5
>> > hw.usb.wsp.pressure_touch_threshold: 50
>> > hw.usb.wsp.pressure_untouch_threshold: 10
>> > hw.usb.wsp.pressure_tap_threshold: 120
>> > hw.usb.wsp.scr_hor_threshold: 50
>> >
>> > Cheers,
>> >
>> > Huang Wen Hui
>> > ___
>> > freebsd-current@freebsd.org mailing list
>> > http://lists.freebsd.org/mailman/listinfo/freebsd-current
>> > To unsubscribe, send any mail to "
>> freebsd-current-unsubscr...@freebsd.org"
>> ___
>> freebsd-current@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-current
>> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org
>> "
>>
>
>

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
---
CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Apple Trackpad driver

2014-01-28 Thread Lundberg, Johannes
This is really good news :)  I will try it on my 2012 and 2013 MBAs soon!
(hopefully it is same hardware as in the pros)

--
Johannes Lundberg
BRILLIANTSERVICE CO., LTD.


On Wed, Jan 29, 2014 at 2:13 PM, Adrian Chadd  wrote:

> holy crap, cool!
>
> Hans? Any chance we could get this into -HEAD?
>
>
> -a
>
>
> On 28 January 2014 17:43, Huang Wen Hui  wrote:
> > Hi,
> > I have a working trackpad driver  for my MBP 2013, I am not  C programmer
> > usually,
> > so the code may ugly. If someone like to test, you can download it from
> > http://sw.gddsn.org.cn/freebsd/wsp-140129.tar.gz,
> > I only test it on MBP2012 and MBP2013. Right now the driver have these
> > feature:
> >
> > 1. Vertical scrolling with 2 fingers movement,
> > 2. In firefox, 2 fingers horizontal movement act as page back/forward.
> > 3. one finger tap act as left mouse click, 2 fingers tap act as right
> mouse
> > click, and
> > three fingers tap act as middle mouse click.
> > 4. you also use sysctl to modify some parameters:
> > hw.usb.wsp.scale_factor: 12
> > hw.usb.wsp.z_factor: 5
> > hw.usb.wsp.pressure_touch_threshold: 50
> > hw.usb.wsp.pressure_untouch_threshold: 10
> > hw.usb.wsp.pressure_tap_threshold: 120
> > hw.usb.wsp.scr_hor_threshold: 50
> >
> > Cheers,
> >
> > Huang Wen Hui
> > ___
> > freebsd-current@freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-current
> > To unsubscribe, send any mail to "
> freebsd-current-unsubscr...@freebsd.org"
> ___
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
>

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
---
CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Apple Trackpad driver

2014-01-28 Thread Adrian Chadd
holy crap, cool!

Hans? Any chance we could get this into -HEAD?


-a


On 28 January 2014 17:43, Huang Wen Hui  wrote:
> Hi,
> I have a working trackpad driver  for my MBP 2013, I am not  C programmer
> usually,
> so the code may ugly. If someone like to test, you can download it from
> http://sw.gddsn.org.cn/freebsd/wsp-140129.tar.gz,
> I only test it on MBP2012 and MBP2013. Right now the driver have these
> feature:
>
> 1. Vertical scrolling with 2 fingers movement,
> 2. In firefox, 2 fingers horizontal movement act as page back/forward.
> 3. one finger tap act as left mouse click, 2 fingers tap act as right mouse
> click, and
> three fingers tap act as middle mouse click.
> 4. you also use sysctl to modify some parameters:
> hw.usb.wsp.scale_factor: 12
> hw.usb.wsp.z_factor: 5
> hw.usb.wsp.pressure_touch_threshold: 50
> hw.usb.wsp.pressure_untouch_threshold: 10
> hw.usb.wsp.pressure_tap_threshold: 120
> hw.usb.wsp.scr_hor_threshold: 50
>
> Cheers,
>
> Huang Wen Hui
> ___
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"