summaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2017-05-26 18:32:43 -0400
committerGitHub <noreply@github.com>2017-05-26 18:32:43 -0400
commit453877422bddd7c83ae8b893e79203cb5d868cf7 (patch)
tree4a8e66adc77bb754261217ca95df5f21ae9ae96f /tmk_core
parent9851e6f3b156e3d77a2c9af01872e8bb550ca226 (diff)
parent6b994ecd82f660feb44bac376ae7d0147d40d818 (diff)
Merge pull request #1327 from Dbroqua/master
Added Integration of IBM Trackpoint
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/common/action.c34
-rw-r--r--tmk_core/protocol/ps2_mouse.c29
2 files changed, 45 insertions, 18 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index a534f818ec..f73b0fe807 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -34,6 +34,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "nodebug.h"
#endif
+int tp_buttons;
+
#ifdef FAUXCLICKY_ENABLE
#include <fauxclicky.h>
#endif
@@ -311,11 +313,35 @@ void process_action(keyrecord_t *record, action_t action)
/* Mouse key */
case ACT_MOUSEKEY:
if (event.pressed) {
- mousekey_on(action.key.code);
- mousekey_send();
+ switch (action.key.code) {
+ case KC_MS_BTN1:
+ tp_buttons |= (1<<0);
+ break;
+ case KC_MS_BTN2:
+ tp_buttons |= (1<<1);
+ break;
+ case KC_MS_BTN3:
+ tp_buttons |= (1<<2);
+ break;
+ default:
+ mousekey_on(action.key.code);
+ mousekey_send();
+ }
} else {
- mousekey_off(action.key.code);
- mousekey_send();
+ switch (action.key.code) {
+ case KC_MS_BTN1:
+ tp_buttons &= ~(1<<0);
+ break;
+ case KC_MS_BTN2:
+ tp_buttons &= ~(1<<1);
+ break;
+ case KC_MS_BTN3:
+ tp_buttons &= ~(1<<2);
+ break;
+ default:
+ mousekey_off(action.key.code);
+ mousekey_send();
+ }
}
break;
#endif
diff --git a/tmk_core/protocol/ps2_mouse.c b/tmk_core/protocol/ps2_mouse.c
index d9ccbecb43..4ed3cae1fd 100644
--- a/tmk_core/protocol/ps2_mouse.c
+++ b/tmk_core/protocol/ps2_mouse.c
@@ -72,12 +72,13 @@ void ps2_mouse_init_user(void) {
void ps2_mouse_task(void) {
static uint8_t buttons_prev = 0;
+ extern int tp_buttons;
/* receives packet from mouse */
uint8_t rcv;
rcv = ps2_host_send(PS2_MOUSE_READ_DATA);
if (rcv == PS2_ACK) {
- mouse_report.buttons = ps2_host_recv_response();
+ mouse_report.buttons = ps2_host_recv_response() | tp_buttons;
mouse_report.x = ps2_host_recv_response() * PS2_MOUSE_X_MULTIPLIER;
mouse_report.y = ps2_host_recv_response() * PS2_MOUSE_Y_MULTIPLIER;
#ifdef PS2_MOUSE_ENABLE_SCROLLING
@@ -106,34 +107,34 @@ void ps2_mouse_task(void) {
#endif
host_mouse_send(&mouse_report);
}
-
+
ps2_mouse_clear_report(&mouse_report);
}
void ps2_mouse_disable_data_reporting(void) {
- PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting");
+ PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting");
}
void ps2_mouse_enable_data_reporting(void) {
PS2_MOUSE_SEND(PS2_MOUSE_ENABLE_DATA_REPORTING, "ps2 mouse enable data reporting");
}
-void ps2_mouse_set_remote_mode(void) {
- PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_REMOTE_MODE, "ps2 mouse set remote mode");
+void ps2_mouse_set_remote_mode(void) {
+ PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_REMOTE_MODE, "ps2 mouse set remote mode");
ps2_mouse_mode = PS2_MOUSE_REMOTE_MODE;
}
-void ps2_mouse_set_stream_mode(void) {
- PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_STREAM_MODE, "ps2 mouse set stream mode");
+void ps2_mouse_set_stream_mode(void) {
+ PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_STREAM_MODE, "ps2 mouse set stream mode");
ps2_mouse_mode = PS2_MOUSE_STREAM_MODE;
}
void ps2_mouse_set_scaling_2_1(void) {
- PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_2_1, "ps2 mouse set scaling 2:1");
+ PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_2_1, "ps2 mouse set scaling 2:1");
}
void ps2_mouse_set_scaling_1_1(void) {
- PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_1_1, "ps2 mouse set scaling 1:1");
+ PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_1_1, "ps2 mouse set scaling 1:1");
}
void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution) {
@@ -204,9 +205,9 @@ static inline void ps2_mouse_enable_scrolling(void) {
#define PRESS_SCROLL_BUTTONS mouse_report->buttons |= (PS2_MOUSE_SCROLL_BTN_MASK)
#define RELEASE_SCROLL_BUTTONS mouse_report->buttons &= ~(PS2_MOUSE_SCROLL_BTN_MASK)
static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) {
- static enum {
- SCROLL_NONE,
- SCROLL_BTN,
+ static enum {
+ SCROLL_NONE,
+ SCROLL_BTN,
SCROLL_SENT,
} scroll_state = SCROLL_NONE;
static uint16_t scroll_button_time = 0;
@@ -228,10 +229,10 @@ static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) {
mouse_report->y = 0;
}
} else if (0 == (PS2_MOUSE_SCROLL_BTN_MASK & mouse_report->buttons)) {
- // None of the scroll buttons are pressed
+ // None of the scroll buttons are pressed
#if PS2_MOUSE_SCROLL_BTN_SEND
- if (scroll_state == SCROLL_BTN
+ if (scroll_state == SCROLL_BTN
&& timer_elapsed(scroll_button_time) < PS2_MOUSE_SCROLL_BTN_SEND) {
PRESS_SCROLL_BUTTONS;
host_mouse_send(mouse_report);