Changeset e4f8c77 in mainline for uspace/srv/hid/input/ctl/pc.c


Ignore:
Timestamp:
2011-07-13T22:39:18Z (13 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e6910c8
Parents:
5974661 (diff), 8ecef91 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge libposix.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/input/ctl/pc.c

    r5974661 re4f8c77  
    11/*
    2  * Copyright (c) 2009 Jiri Svoboda
     2 * Copyright (c) 2011 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2828
    2929/** @addtogroup kbd_ctl
    30  * @ingroup kbd
     30 * @ingroup input
    3131 * @{
    3232 */
     
    4343#include <gsp.h>
    4444
     45static void pc_ctl_parse(sysarg_t);
     46static int pc_ctl_init(kbd_dev_t *);
     47static void pc_ctl_set_ind(kbd_dev_t *, unsigned int);
     48
     49kbd_ctl_ops_t pc_ctl = {
     50        .parse = pc_ctl_parse,
     51        .init = pc_ctl_init,
     52        .set_ind = pc_ctl_set_ind
     53};
     54
    4555enum dec_state {
    4656        ds_s,
     
    6474
    6575static enum dec_state ds;
     76static kbd_dev_t *kbd_dev;
    6677
    6778static int scanmap_simple[] = {
     
    197208};
    198209
    199 int kbd_ctl_init(void)
     210static int pc_ctl_init(kbd_dev_t *kdev)
    200211{
     212        kbd_dev = kdev;
    201213        ds = ds_s;
    202214        return 0;
    203215}
    204216
    205 void kbd_ctl_parse_scancode(int scancode)
     217static void pc_ctl_parse(sysarg_t scancode)
    206218{
    207219        kbd_event_type_t type;
     
    245257        }
    246258
    247         if ((scancode < 0) || ((size_t) scancode >= map_length))
     259        if ((size_t) scancode >= map_length)
    248260                return;
    249261
    250262        key = map[scancode];
    251263        if (key != 0)
    252                 kbd_push_ev(type, key);
     264                kbd_push_event(kbd_dev, type, key);
    253265}
    254266
    255 void kbd_ctl_set_ind(unsigned mods)
     267static void pc_ctl_set_ind(kbd_dev_t *kdev, unsigned mods)
    256268{
    257269        uint8_t b;
     
    265277                b = b | LI_SCROLL;
    266278
    267         kbd_port_write(KBD_CMD_SET_LEDS);
    268         kbd_port_write(b);
     279        (*kbd_dev->port_ops->write)(KBD_CMD_SET_LEDS);
     280        (*kbd_dev->port_ops->write)(b);
    269281}
    270282
Note: See TracChangeset for help on using the changeset viewer.