... and I see a HID mouse show up in device manager. The problem is I dont get any mouse movement.The HID mouse will show up as soon as the appropriate descriptor is compiled in - have you had a look at any values reported in the PS/2 part of your firmware? Before worrying about the complete mouse, I'd suggest to get communication with the trackpoint started to make sure your physical connection is ok. When the teensy can connect to the trackpoint the rest is trivial.
Sharing your code on github or similar service will be very helpful to others.
How did you connect your Trackpoint to Teensy? I can't see from the pic.
And are you sure about your pin confgure in config.h?
Unfortunately PS/2 mouse support is not documented and has been untouched for long time.
To be honest I don't know if PS/2 mouse works with ps2_usb converter. PS/2 is a bit complecated and resource eater I'm concerned whether my code can take care of two PS/2 line same time. And it doesn't seems to be configurable both PS/2 keyboard and PS/2 mouse connection same time.
Theoretically PS/2 mouse support can work with any other converter and keyboard projects.
EDIT: ummm, looks like PS/2 mouse support is broken now.
Don't know about the way PS/2 is currently implemented in hasus firmware and I do not remember if I got my trackpoints to work with it at some point, but somewhere the connection to the trackpoint has to be initialized via a specific command sequence - that would be the first place to check.
You can see in ps_init_mouse() (https://github.com/frobiac/adnw/blob/master/src/ps2mouse.c#L186) how I do it in my firmware, and have a look at the other setup calls in trackpoint.c once that works as expected. It may be necessary to reset the trackpoint before, but I am not sure - at least I have it in my firmware like that.
Hopefully this will provide some more information on where it goes wrong, but if the wiring is correct you should be able to figure it out.
I finally fixed PS/2 mouse problem of my tmk_keyboard. Try 'onekey' project latest code If you are still interested.
Connect data to PD2 and clock to PD5, you can configure pin assign but note that PD0 and PD1 are already used in matrix.c for one-switch keyboard.
I've been stuck full a few days due to unstable startup behaviour of TrackPoint. In the end I found the fact it needs external reset circuit in its datasheet. Without this TrackPoint might be initialise correctly or not. TIL: datasheet is my friend.
Get master branch and look at keyboard/onekey. onekey branch is old, I'll remove it.
And I changed pin configuration or the project after that post.
1. Remove comment out marks of these lines in Makefile to enable PS/2 mouse support.
PS2_MOUSE_ENABLE = yes
PS2_USE_BUSYWAIT = yes
2. connect TrackPoint
PD1 for clock line
PD2 for data line
3. make
My question is where the other wire from the switch would go. I am guessing to the VCC on my teensy but I could be wrong.
Final question is unlike all other thinkpad keyboards there are 8 wires going to the trackpoint button area. Every other trackpoint keyboard I have seen only has four. Can anyone hypothesize why this is the case (Id rather not remove the plastic component as it is riveting in place and well suited for my project.
My second question is that I would rather leave the plastic base of the trackpoint buttons attached to the metal frame. I plan to use a Dremel to cut the aluminum to excise the buttons. To connect my electronics to the ribbon I will use a silver conductive glue.Copper tape? It can be soldered with cable and you can stick it to conductive line on membrane sheet.
Is this the best way to join to the ribbon cable?
My second question is that I would rather leave the plastic base of the trackpoint buttons attached to the metal frame. I plan to use a Dremel to cut the aluminum to excise the buttons. To connect my electronics to the ribbon I will use a silver conductive glue.Copper tape? It can be soldered with cable and you can stick it to conductive line on membrane sheet.
Is this the best way to join to the ribbon cable?Show Image(http://i.imgur.com/LNl4w.jpg)
And this post and thread also will help.
http://geekhack.org/index.php?topic=52481.msg1164174#msg1164174
Get master branch and look at keyboard/onekey. onekey branch is old, I'll remove it.
And I changed pin configuration or the project after that post.
1. Remove comment out marks of these lines in Makefile to enable PS/2 mouse support.
PS2_MOUSE_ENABLE = yes
PS2_USE_BUSYWAIT = yes
2. connect TrackPoint
PD1 for clock line
PD2 for data line
3. make
Maybe your firmware resets the button mask somewhere when trackpoint is active?This.
I manually OR both the keyboards mouse button keys with the actual wired buttons detected before sending the MouseReport outIn case of t.m.k. this will (probably) register the mouse button twice, once through MouseKeys and once through ps2_mouse.
#ifdef MOUSEKEY_ENABLE
/* Mouse key */
case ACT_MOUSEKEY:
if (event.pressed) {
mousekey_on(action.key.code);
mousekey_send();
} else {
mousekey_off(action.key.code);
mousekey_send();
}
break;
#endif
#ifdef MOUSEKEY_ENABLE
/* Mouse key */
case ACT_MOUSEKEY:
if (event.pressed) {
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 {
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
// sensitivity
rcx = ps2_host_send(0xE2);
rcx = ps2_host_send(0x81);
rcx = ps2_host_send(0x4A);
rcx = ps2_host_send(0xFF);
// speed (transfer function upper plateau speed)
rcx = ps2_host_send(0xE2);
rcx = ps2_host_send(0x81);
rcx = ps2_host_send(0x60);
rcx = ps2_host_send(0xFF);
#ifdef TP_PRESS_TO_SELECT
// enable press-to-select
rcx = ps2_host_send(0xE2);
rcx = ps2_host_send(0x47);
rcx = ps2_host_send(0x2C);
rcx = ps2_host_send(0x01);
#endif
I prefer the firmware based method but don't want to change the original code, because this would ruin the x, y readings for other ps2 mouse.But using swapxy would change the firmware too? You could put a switch into the makefile and use #ifdef.
// checking the boundary of x and y?
#ifdef TP_SWAPXY
#define Y_IS_NEG (mouse_report.buttons & (1<<PS2_MOUSE_X_SIGN))
#define X_IS_NEG (mouse_report.buttons & (1<<PS2_MOUSE_Y_SIGN))
#define Y_IS_OVF (mouse_report.buttons & (1<<PS2_MOUSE_X_OVFLW))
#define X_IS_OVF (mouse_report.buttons & (1<<PS2_MOUSE_Y_OVFLW))
#else
#define X_IS_NEG (mouse_report.buttons & (1<<PS2_MOUSE_X_SIGN))
#define Y_IS_NEG (mouse_report.buttons & (1<<PS2_MOUSE_Y_SIGN))
#define X_IS_OVF (mouse_report.buttons & (1<<PS2_MOUSE_X_OVFLW))
#define Y_IS_OVF (mouse_report.buttons & (1<<PS2_MOUSE_Y_OVFLW))
#endif
#ifdef TP_SWAPXY
mouse_report.y = ps2_host_recv_response();
mouse_report.x = ps2_host_recv_response();
#else
mouse_report.x = ps2_host_recv_response();
mouse_report.y = ps2_host_recv_response();
#endif
#ifdef TP_SWAPXY
// invert x
rcx = ps2_host_send(0xE2);
rcx = ps2_host_send(0x81);
rcx = ps2_host_send(0x2C);
rcx = ps2_host_send(0x08);
#endif
void ps2_mouse_task(void)
{
enum { SCROLL_NONE, SCROLL_BTN, SCROLL_SENT };
static uint8_t scroll_state = SCROLL_NONE;
static uint8_t buttons_prev = 0;
/* 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.x = ps2_host_recv_response();
mouse_report.y = ps2_host_recv_response();
} else {
if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n");
return;
}
to this: void ps2_mouse_task(void)
{
enum { SCROLL_NONE, SCROLL_BTN, SCROLL_SENT };
static uint8_t scroll_state = SCROLL_NONE;
static uint8_t buttons_prev = 0;
extern 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() | tp_buttons;
mouse_report.x = ps2_host_recv_response();
mouse_report.y = ps2_host_recv_response();
} else {
if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n");
return;
}
int tp_buttons;