But stock ApplePS2Mouse works fine with my trackpad, without scroll.
I made simple modification to emulate middle button as scroll.
So
press left then press right then drag.
Enjoy!
Click to view attachment
Additions very simple
CODE
void ApplePS2Mouse::dispatchRelativePointerEventWithPacket(UInt8 * packet,
UInt32 packetSize)
{
............
SInt16 dz = 0, dzx = 0;
AbsoluteTime now;
/*
if ( (packet[0] & 0x1) ) buttons |= 0x1; // left button (bit 0 in packet)
if ( (packet[0] & 0x2) ) buttons |= 0x2; // right button (bit 1 in packet)
if ( (packet[0] & 0x4) ) buttons |= 0x4; // middle button (bit 2 in packet)
*/
dx = ((packet[0] & 0x10) ? 0xffffff00 : 0 ) | packet[1];
dy = -(((packet[0] & 0x20) ? 0xffffff00 : 0 ) | packet[2]);
if ( (packet[0] & 0x1) && (packet[0] & 0x2) )
/* Simulate middle button by pressing left and right button simultaneously */
{
buttons |= 0x4; // middle button
//Slice middle button = scroll
dz = dy; dzx = dx;
}
else
{
if ( (packet[0] & 0x1) ) buttons |= 0x1; // left button (bit 0 in packet)
if ( (packet[0] & 0x2) ) buttons |= 0x2; // right button (bit 1 in packet)
}
clock_get_uptime((uint64_t *)&now);
if((dz|dzx)!=0) /* Do we have any scroll event? if so dispatch it */
{
dispatchScrollWheelEvent(dz,dzx,0,now);
}
else
dispatchRelativePointerEvent(dx, dy, buttons, now);
UInt32 packetSize)
{
............
SInt16 dz = 0, dzx = 0;
AbsoluteTime now;
/*
if ( (packet[0] & 0x1) ) buttons |= 0x1; // left button (bit 0 in packet)
if ( (packet[0] & 0x2) ) buttons |= 0x2; // right button (bit 1 in packet)
if ( (packet[0] & 0x4) ) buttons |= 0x4; // middle button (bit 2 in packet)
*/
dx = ((packet[0] & 0x10) ? 0xffffff00 : 0 ) | packet[1];
dy = -(((packet[0] & 0x20) ? 0xffffff00 : 0 ) | packet[2]);
if ( (packet[0] & 0x1) && (packet[0] & 0x2) )
/* Simulate middle button by pressing left and right button simultaneously */
{
buttons |= 0x4; // middle button
//Slice middle button = scroll
dz = dy; dzx = dx;
}
else
{
if ( (packet[0] & 0x1) ) buttons |= 0x1; // left button (bit 0 in packet)
if ( (packet[0] & 0x2) ) buttons |= 0x2; // right button (bit 1 in packet)
}
clock_get_uptime((uint64_t *)&now);
if((dz|dzx)!=0) /* Do we have any scroll event? if so dispatch it */
{
dispatchScrollWheelEvent(dz,dzx,0,now);
}
else
dispatchRelativePointerEvent(dx, dy, buttons, now);
