--- a/omap3530/beagle_drivers/serialmouse/serialmouse.cpp Tue Feb 02 21:04:35 2010 +0000
+++ b/omap3530/beagle_drivers/serialmouse/serialmouse.cpp Tue Feb 09 19:13:57 2010 +0000
@@ -40,6 +40,8 @@
# define CURSOR_SIZE 5
#endif
+// AndyS Add support for sending keyboard events
+#define STDKEY(x) (0x1FFF&(x))
LOCAL_C TInt halFunction(TAny* aPtr, TInt aFunction, TAny* a1, TAny* a2)
{
@@ -75,10 +77,13 @@
if (r!=KErrNone)
return r;
+ Kern::Printf("TSerialMouse initialising");
__KTRACE_OPT(KBOOT,Kern::Printf("+TSerialMouse::Init")) ;
-
+/*
iDebugPort = Kern::SuperPage().iDebugPort; // Get the debug port number
+ Kern::Printf("Debugport=%d", iDebugPort);
+
if( Arm::EDebugPortJTAG == iDebugPort )
{
__KTRACE_OPT(KBOOT,Kern::Printf("-TSerialMouse::Init: JTAG not supported"));
@@ -91,7 +96,7 @@
// We don't want to return an error here, just don't bother to initialize
return KErrNone;
}
-
+*/
// Register with the power resource manager
//r = PowerResourceManager::RegisterClient( iPrmClientId, KName );
@@ -102,6 +107,9 @@
//__KTRACE_OPT(KBOOT,Kern::Printf("+TSerialMouse::Init:PRM client ID=%x", iPrmClientId )) ;
+ Prcm::SetClockState(iUart.PrcmInterfaceClk(), Prcm::EClkOn);
+ Prcm::SetClockState(iUart.PrcmFunctionClk(), Prcm::EClkOn);
+
r =Interrupt::Bind( iUart.InterruptId(),Isr,this);
if ( r < 0 )
{
@@ -132,7 +140,9 @@
iUart.Enable();
Interrupt::Enable(iUart.InterruptId());
-
+
+ Kern::Printf("TSerialMouse initialised ID=%d", iUart.InterruptId());
+
return KErrNone;
}
@@ -180,7 +190,6 @@
{
const TUint8 b = iKey;
-
if ( b & 1<<6 )
{
// Beginning of a new frame
@@ -202,6 +211,8 @@
const TBool isLeftButtonDown = iB0& 1<<5;
const TBool isRightButtonDown = iB0& 1<<4;
+ Kern::Printf("Mouse dx=%d dy=%d lmb=%d", x_increment, y_increment, isLeftButtonDown);
+
# ifdef _FRAME_BUFFER_CURSOR_
iLastX = iX;
iLastY = iY;
@@ -223,8 +234,15 @@
if ( rightButtonEvent )
{
- e.Set( isRightButtonDown ? TRawEvent::EButton2Down : TRawEvent::EButton2Up, iX, iY );
- Kern::AddEvent(e);
+ if(isRightButtonDown)
+ {
+ e.Set( isRightButtonDown ? TRawEvent::EButton2Down : TRawEvent::EButton2Up, iX, iY );
+ Kern::AddEvent(e);
+ }
+ else
+ {
+ AddKey(EStdKeyApplication0);
+ }
//DBG_PRINT1(_L(" right:%S"), isRightButtonDown?&_L("down"):&_L("up") );
}
@@ -408,6 +426,21 @@
__ASSERT_ALWAYS( r == KErrNone, Kern::Fault( "SERKEY-Cr", r ) );
}
+// AndyS support for sending keypresses
+void TSerialMouse::AddKey( TUint aKey )
+ {
+ const TUint8 stdKey = STDKEY(aKey);
+
+ TRawEvent e;
+
+ Kern::Printf("AddKey %d", stdKey);
+
+ e.Set( TRawEvent::EKeyDown, stdKey, 0 );
+ Kern::AddEvent( e );
+ e.Set( TRawEvent::EKeyUp, stdKey, 0 );
+ Kern::AddEvent( e );
+}
+
//
// Kernel Extension entry point