Changeset db9ef0c in mainline for uspace/drv/char/ps2mouse/ps2mouse.c


Ignore:
Timestamp:
2011-12-31T12:16:21Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c637571
Parents:
3fac882d
Message:

ps2mouse: Fix movement parsing.

It is reported as 9bit values.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/char/ps2mouse/ps2mouse.c

    r3fac882d rdb9ef0c  
    176176                        continue;
    177177                }
     178
    178179                /* Buttons */
    179180                for (unsigned i = 0; i < BUTTON_COUNT; ++i) {
     
    184185                        }
    185186                }
     187
    186188                /* Movement */
    187                 const int move_x = ((packet[0] & X_SIGN)
    188                     ? (int)(int8_t)packet[1] : (int)packet[1]);
    189                 const int move_y = -((packet[0] & Y_SIGN)
    190                     ? (int)(int8_t)packet[2] : (int)packet[2]);
     189                const int16_t move_x =
     190                    ((packet[0] & X_SIGN) ? 0xff00 : 0) | packet[1];
     191                const int16_t move_y =
     192                    (((packet[0] & Y_SIGN) ? 0xff00 : 0) | packet[2]);
     193                //TODO: Consider overflow bit
    191194                if (move_x != 0 || move_y != 0) {
    192                         async_msg_2(exch, MOUSEEV_MOVE_EVENT, move_x, move_y);
     195                        async_msg_2(exch, MOUSEEV_MOVE_EVENT, move_x, -move_y);
    193196                }
    194197                async_exchange_end(exch);
Note: See TracChangeset for help on using the changeset viewer.