Advertisement
joric

hidemukbd.diff

May 19th, 2017
572
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.79 KB | None | 0 0
  1. --- hidemukbd.orig.c    Thu Aug 15 14:28:40 2013
  2. +++ hidemukbd.c Sun May 21 15:28:37 2017
  3. @@ -216,7 +216,7 @@
  4.  
  5.  static void hidEmuKbd_ProcessOSALMsg( osal_event_hdr_t *pMsg );
  6.  static void hidEmuKbd_HandleKeys( uint8 shift, uint8 keys );
  7. -static void hidEmuKbdSendReport( uint8 keycode );
  8. +static void hidEmuKbdSendReport( uint8 modifier, uint8 keycode );
  9.  static void hidEmuKbdSendMouseReport( uint8 buttons );
  10.  static uint8 hidEmuKbdRcvReport( uint8 len, uint8 *pData );
  11.  static uint8 hidEmuKbdRptCB( uint8 id, uint8 type, uint16 uuid,
  12. @@ -261,7 +261,7 @@
  13.    
  14.    // Setup the GAP Peripheral Role Profile
  15.    {
  16. -    uint8 initial_advertising_enable = FALSE;
  17. +    uint8 initial_advertising_enable = TRUE;
  18.  
  19.      // By setting this to zero, the device will go into the waiting state after
  20.      // being discoverable for 30.72 second, and will not being advertising again
  21. @@ -293,11 +293,11 @@
  22.  
  23.    // Setup the GAP Bond Manager
  24.    {
  25. -    uint32 passkey = DEFAULT_PASSCODE;
  26. -    uint8 pairMode = DEFAULT_PAIRING_MODE;
  27. -    uint8 mitm = DEFAULT_MITM_MODE;
  28. -    uint8 ioCap = DEFAULT_IO_CAPABILITIES;
  29. -    uint8 bonding = DEFAULT_BONDING_MODE;
  30. +    uint32 passkey = 0; // passkey "000000"
  31. +    uint8 pairMode = GAPBOND_PAIRING_MODE_WAIT_FOR_REQ;
  32. +    uint8 mitm = FALSE;
  33. +    uint8 ioCap = GAPBOND_IO_CAP_NO_INPUT_NO_OUTPUT;
  34. +    uint8 bonding = TRUE;
  35.      GAPBondMgr_SetParameter( GAPBOND_DEFAULT_PASSCODE, sizeof( uint32 ), &passkey );
  36.      GAPBondMgr_SetParameter( GAPBOND_PAIRING_MODE, sizeof( uint8 ), &pairMode );
  37.      GAPBondMgr_SetParameter( GAPBOND_MITM_PROTECTION, sizeof( uint8 ), &mitm );
  38. @@ -433,13 +433,13 @@
  39.    if ( (keys & HAL_KEY_SW_1) && (prevKey1 == 0) )
  40.    {
  41.      // pressed
  42. -    hidEmuKbdSendReport( KEY_LEFT_ARROW );
  43. +    hidEmuKbdSendReport( 0, KEY_LEFT_ARROW );
  44.      prevKey1 = 1;
  45.    }
  46.    else if ( !(keys & HAL_KEY_SW_1) && (prevKey1 == 1) )
  47.    {
  48.      // released
  49. -    hidEmuKbdSendReport( KEY_NONE );
  50. +    hidEmuKbdSendReport( 0, KEY_NONE );
  51.      prevKey1 = 0;
  52.    }
  53.  
  54. @@ -448,7 +448,7 @@
  55.      // pressed
  56.      if ( !hidBootMouseEnabled )
  57.      {
  58. -      hidEmuKbdSendReport( KEY_RIGHT_ARROW );
  59. +      hidEmuKbdSendReport( 0x80, KEY_NONE ); // winkey
  60.      }
  61.      else
  62.      {
  63. @@ -461,7 +461,7 @@
  64.      // released
  65.      if ( !hidBootMouseEnabled )
  66.      {
  67. -      hidEmuKbdSendReport( KEY_NONE );
  68. +      hidEmuKbdSendReport( 0, KEY_NONE );
  69.      }
  70.      else
  71.      {
  72. @@ -480,11 +480,11 @@
  73.   *
  74.   * @return  none
  75.   */
  76. -static void hidEmuKbdSendReport( uint8 keycode )
  77. +static void hidEmuKbdSendReport( uint8 modifier, uint8 keycode )
  78.  {
  79.    uint8 buf[HID_KEYBOARD_IN_RPT_LEN];
  80.  
  81. -  buf[0] = 0;         // Modifier keys
  82. +  buf[0] = modifier;  // Modifier keys
  83.    buf[1] = 0;         // Reserved
  84.    buf[2] = keycode;   // Keycode 1
  85.    buf[3] = 0;         // Keycode 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement