Changes in / [3b2e387:40f606b] in mainline


Ignore:
Files:
14 added
8 deleted
45 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/amd64/Makefile.inc

    r3b2e387 r40f606b  
    3535
    3636RD_SRVS_NON_ESSENTIAL += \
    37         $(USPACE_PATH)/srv/bd/ata_bd/ata_bd
     37        $(USPACE_PATH)/srv/bd/ata_bd/ata_bd \
     38        $(USPACE_PATH)/srv/hid/char_mouse/char_ms
    3839
    3940RD_DRVS += \
  • boot/arch/ppc32/Makefile.inc

    r3b2e387 r40f606b  
    4343        $(USPACE_PATH)/srv/hw/bus/cuda_adb/cuda_adb
    4444
     45RD_SRVS_NON_ESSENTIAL += \
     46        $(USPACE_PATH)/srv/hid/adb_mouse/adb_ms
     47
    4548RD_DRVS += \
    4649        infrastructure/rootmac
  • uspace/Makefile

    r3b2e387 r40f606b  
    8181        srv/fs/devfs \
    8282        srv/fs/ext2fs \
     83        srv/hid/adb_mouse \
     84        srv/hid/char_mouse \
    8385        srv/hid/s3c24xx_ts \
    8486        srv/hid/fb \
  • uspace/app/init/init.c

    r3b2e387 r40f606b  
    275275        srv_start("/srv/i8042");
    276276        srv_start("/srv/s3c24ser");
     277        srv_start("/srv/adb_ms");
     278        srv_start("/srv/char_ms");
    277279        srv_start("/srv/s3c24ts");
    278280       
    279281        spawn("/srv/fb");
    280282        spawn("/srv/input");
    281         console("hid/input");
     283        console("hid_in/input");
    282284       
    283285        spawn("/srv/clip");
  • uspace/app/klog/klog.c

    r3b2e387 r40f606b  
    143143 * Receives kernel klog notifications.
    144144 *
    145  * @param callid IPC call ID
    146  * @param call   IPC call structure
    147  * @param arg    Local argument
     145 * @param callid        IPC call ID
     146 * @param call          IPC call structure
     147 * @param arg           Local argument
    148148 *
    149149 */
  • uspace/app/mkbd/main.c

    r3b2e387 r40f606b  
    280280        size_t actual_size;
    281281        int event_nr;
    282        
     282
    283283        while (true) {
    284284                /** @todo Try blocking call. */
  • uspace/app/trace/trace.c

    r3b2e387 r40f606b  
    792792        proto_register(SERVICE_VFS, p);
    793793
    794 #if 0
    795794        p = proto_new("console");
    796795
     
    828827        proto_console = p;
    829828        proto_register(SERVICE_CONSOLE, p);
    830 #endif
    831829}
    832830
  • uspace/drv/bus/usb/usbhid/mouse/mousedev.c

    r3b2e387 r40f606b  
    4444#include <async_obsolete.h>
    4545#include <str_error.h>
    46 #include <ipc/mouseev.h>
     46#include <ipc/mouse.h>
    4747#include <io/console.h>
    4848
     
    270270        if ((shift_x != 0) || (shift_y != 0)) {
    271271                async_obsolete_req_2_0(mouse_dev->mouse_phone,
    272                     MOUSEEV_MOVE_EVENT, shift_x, shift_y);
     272                    MEVENT_MOVE, shift_x, shift_y);
    273273        }
    274274
     
    296296                    && field->value != 0) {
    297297                        async_obsolete_req_2_0(mouse_dev->mouse_phone,
    298                             MOUSEEV_BUTTON_EVENT, field->usage, 1);
     298                            MEVENT_BUTTON, field->usage, 1);
    299299                        mouse_dev->buttons[field->usage - field->usage_minimum]
    300300                            = field->value;
    301                 } else if (mouse_dev->buttons[field->usage - field->usage_minimum] != 0
     301                } else if (
     302                    mouse_dev->buttons[field->usage - field->usage_minimum] != 0
    302303                    && field->value == 0) {
    303                         async_obsolete_req_2_0(mouse_dev->mouse_phone,
    304                            MOUSEEV_BUTTON_EVENT, field->usage, 0);
    305                         mouse_dev->buttons[field->usage - field->usage_minimum] =
    306                            field->value;
    307                 }
     304                       async_obsolete_req_2_0(mouse_dev->mouse_phone,
     305                           MEVENT_BUTTON, field->usage, 0);
     306                       mouse_dev->buttons[field->usage - field->usage_minimum]
     307                           = field->value;
     308               }
    308309               
    309310                field = usb_hid_report_get_sibling(
  • uspace/drv/bus/usb/usbmouse/mouse.c

    r3b2e387 r40f606b  
    3838#include <errno.h>
    3939#include <str_error.h>
    40 #include <ipc/mouseev.h>
     40#include <ipc/mouse.h>
    4141#include <async.h>
    4242#include "mouse.h"
     
    8686                       
    8787                        async_exch_t *exch = async_exchange_begin(mouse->console_sess);
    88                         async_req_2_0(exch, MOUSEEV_MOVE_EVENT, -shift_x / 10, -shift_y / 10);
     88                        async_req_2_0(exch, MEVENT_MOVE, -shift_x / 10, -shift_y / 10);
    8989                        async_exchange_end(exch);
    9090                }
     
    9393                       
    9494                        async_exch_t *exch = async_exchange_begin(mouse->console_sess);
    95                         async_req_2_0(exch, MOUSEEV_BUTTON_EVENT, 1, 1);
    96                         async_req_2_0(exch, MOUSEEV_BUTTON_EVENT, 1, 0);
     95                        async_req_2_0(exch, MEVENT_BUTTON, 1, 1);
     96                        async_req_2_0(exch, MEVENT_BUTTON, 1, 0);
    9797                        async_exchange_end(exch);
    9898                }
  • uspace/lib/c/generic/async.c

    r3b2e387 r40f606b  
    213213 * This function is defined as a weak symbol - to be redefined in user code.
    214214 *
    215  * @param callid Hash of the incoming call.
    216  * @param call   Data of the incoming call.
    217  * @param arg    Local argument
     215 * @param callid        Hash of the incoming call.
     216 * @param call          Data of the incoming call.
     217 * @param arg           Local argument
    218218 *
    219219 */
     
    228228 * This function is defined as a weak symbol - to be redefined in user code.
    229229 *
    230  * @param callid Hash of the incoming call.
    231  * @param call   Data of the incoming call.
    232  * @param arg    Local argument.
     230 * @param callid        Hash of the incoming call.
     231 * @param call          Data of the incoming call.
     232 * @param arg           Local argument.
    233233 *
    234234 */
     
    709709 * @param cfibril       Fibril function that should be called upon opening the
    710710 *                      connection.
    711  * @param carg          Extra argument to pass to the connection fibril
     711 * @param carg          Extra argument to pass to the connection fibril
    712712 *
    713713 * @return New fibril id or NULL on failure.
  • uspace/lib/c/generic/str.c

    r3b2e387 r40f606b  
    540540
    541541        dstr_size = str_size(dest);
    542         if (dstr_size >= size)
     542        if (dstr_size >= size) {
    543543                return;
    544        
     544        }
    545545        str_cpy(dest + dstr_size, size - dstr_size, src);
    546546}
  • uspace/lib/c/generic/task.c

    r3b2e387 r40f606b  
    190190       
    191191        return EOK;
    192        
    193192error:
    194193        /* Error exit */
  • uspace/lib/c/include/async.h

    r3b2e387 r40f606b  
    5555/** Client connection handler
    5656 *
    57  * @param callid ID of incoming call or 0 if connection initiated from
    58  *               inside using async_connect_to_me()
    59  * @param call   Incoming call or 0 if connection initiated from inside
    60  * @param arg    Local argument passed from async_new_connection() or
    61  *               async_connect_to_me()
     57 * @param callid        ID of incoming call or 0 if connection initiated from
     58 *                      inside using async_connect_to_me()
     59 * @param call          Incoming call or 0 if connection initiated from inside
     60 * @param arg           Local argument passed from async_new_connection() or
     61 *                      async_connect_to_me()
    6262 */
    6363typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *, void *);
  • uspace/lib/c/include/ipc/services.h

    r3b2e387 r40f606b  
    4343        SERVICE_PCI,
    4444        SERVICE_VIDEO,
     45        SERVICE_CONSOLE,
    4546        SERVICE_VFS,
    4647        SERVICE_DEVMAP,
  • uspace/lib/usb/src/debug.c

    r3b2e387 r40f606b  
    6868                if (rc > 0) {
    6969                        log_stream = fopen(fname, "w");
    70                         if (log_stream != NULL)
     70                        if (log_stream != NULL) {
    7171                                setvbuf(log_stream, NULL, _IOFBF, BUFSIZ);
    72                        
     72                        }
    7373                        free(fname);
    7474                }
  • uspace/lib/usbvirt/src/device.c

    r3b2e387 r40f606b  
    4949/** Main IPC call handling from virtual host controller.
    5050 *
    51  * @param iid   Caller identification
    52  * @param icall Initial incoming call
    53  * @param arg   Local argument
     51 * @param iid           Caller identification
     52 * @param icall         Initial incoming call
     53 * @param arg           Local argument
    5454 */
    5555static void callback_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
  • uspace/srv/fs/fat/fat_idx.c

    r3b2e387 r40f606b  
    5959typedef struct {
    6060        link_t          link;
    61         devmap_handle_t devmap_handle;
     61        devmap_handle_t devmap_handle;
    6262
    6363        /** Next unassigned index. */
    64         fs_index_t next;
     64        fs_index_t      next;
    6565        /** Number of remaining unassigned indices. */
    66         uint64_t remaining;
     66        uint64_t        remaining;
    6767
    6868        /** Sorted list of intervals of freed indices. */
    69         list_t freed_list;
     69        list_t          freed_list;
    7070} unused_t;
    7171
     
    9797                        return u;
    9898        }
    99        
     99
    100100        if (lock)
    101101                fibril_mutex_unlock(&unused_lock);
  • uspace/srv/hid/console/console.c

    r3b2e387 r40f606b  
    482482                        retval = ENOENT;
    483483                }
    484 
    485484                async_answer_0(callid, retval);
    486485        }
     
    748747       
    749748        /* NB: The callback connection is slotted for removal */
    750         rc = async_connect_to_me(exch, 0, 0, 0, input_events, NULL);
     749        rc = async_connect_to_me(exch, SERVICE_CONSOLE, 0, 0, input_events,
     750            NULL);
    751751
    752752        async_exchange_end(exch);
  • uspace/srv/hid/input/Makefile

    r3b2e387 r40f606b  
    3636        generic/input.c \
    3737        generic/layout.c \
     38        generic/mouse.c \
    3839        generic/stroke.c \
    3940        layout/cz.c \
     
    4142        layout/us_dvorak.c \
    4243        port/adb.c \
    43         port/adb_mouse.c \
    4444        port/chardev.c \
    45         port/chardev_mouse.c \
    4645        port/gxemul.c \
    4746        port/msim.c \
     
    5251        port/ski.c \
    5352        port/z8530.c \
    54         proto/adb.c \
    55         proto/mousedev.c \
    56         proto/ps2.c \
    5753        ctl/apple.c \
    5854        ctl/gxe_fb.c \
  • uspace/srv/hid/input/ctl/apple.c

    r3b2e387 r40f606b  
    3333/**
    3434 * @file
    35  * @brief Apple ADB keyboard controller driver.
     35 * @brief       Apple ADB keyboard controller driver.
    3636 */
    3737
     
    4242#include <kbd_port.h>
    4343
    44 static void apple_ctl_parse(sysarg_t);
     44static void apple_ctl_parse_scancode(int);
    4545static int apple_ctl_init(kbd_dev_t *);
    46 static void apple_ctl_set_ind(kbd_dev_t *, unsigned int);
     46static void apple_ctl_set_ind(kbd_dev_t *, unsigned);
    4747
    4848kbd_ctl_ops_t apple_ctl = {
    49         .parse = apple_ctl_parse,
     49        .parse_scancode = apple_ctl_parse_scancode,
    5050        .init = apple_ctl_init,
    5151        .set_ind = apple_ctl_set_ind
     
    6464}
    6565
    66 static void apple_ctl_parse(sysarg_t scancode)
     66static void apple_ctl_parse_scancode(int scancode)
    6767{
    6868        kbd_event_type_t type;
    6969        unsigned int key;
    7070
    71         if (scancode >= 0x100)
     71        if (scancode < 0 || scancode >= 0x100)
    7272                return;
    7373
     
    8181        key = scanmap[scancode];
    8282        if (key != 0)
    83                 kbd_push_event(kbd_dev, type, key);
     83                kbd_push_ev(kbd_dev, type, key);
    8484}
    8585
  • uspace/srv/hid/input/ctl/gxe_fb.c

    r3b2e387 r40f606b  
    4444#include <stroke.h>
    4545
    46 static void gxe_fb_ctl_parse(sysarg_t);
     46static void gxe_fb_ctl_parse_scancode(int);
    4747static int gxe_fb_ctl_init(kbd_dev_t *);
    48 static void gxe_fb_ctl_set_ind(kbd_dev_t *, unsigned int);
     48static void gxe_fb_ctl_set_ind(kbd_dev_t *, unsigned);
    4949
    5050kbd_ctl_ops_t gxe_fb_ctl = {
    51         .parse = gxe_fb_ctl_parse,
     51        .parse_scancode = gxe_fb_ctl_parse_scancode,
    5252        .init = gxe_fb_ctl_init,
    5353        .set_ind = gxe_fb_ctl_set_ind
     
    229229}
    230230
    231 static void gxe_fb_ctl_parse(sysarg_t scancode)
     231static void gxe_fb_ctl_parse_scancode(int scancode)
    232232{
    233233        unsigned mods, key;
  • uspace/srv/hid/input/ctl/kbdev.c

    r3b2e387 r40f606b  
    5353
    5454static int kbdev_ctl_init(kbd_dev_t *);
    55 static void kbdev_ctl_set_ind(kbd_dev_t *, unsigned int);
     55static void kbdev_ctl_set_ind(kbd_dev_t *, unsigned);
    5656
    5757static void kbdev_callback_conn(ipc_callid_t, ipc_call_t *, void *arg);
    5858
    5959kbd_ctl_ops_t kbdev_ctl = {
    60         .parse = NULL,
     60        .parse_scancode = NULL,
    6161        .init = kbdev_ctl_init,
    6262        .set_ind = kbdev_ctl_set_ind
     
    116116        sess = fd_session(EXCHANGE_SERIALIZE, fd);
    117117        if (sess == NULL) {
    118                 printf("%s: Failed starting session with '%s'\n", NAME, pathname);
     118                printf(NAME ": Failed starting session with '%s'\n", pathname);
    119119                close(fd);
    120120                return -1;
     
    123123        kbdev = kbdev_new(kdev);
    124124        if (kbdev == NULL) {
    125                 printf("%s: Failed allocating device structure for '%s'.\n",
    126                     NAME, pathname);
     125                printf(NAME ": Failed allocating device structure for '%s'.\n",
     126                    pathname);
    127127                return -1;
    128128        }
     
    133133        exch = async_exchange_begin(sess);
    134134        if (exch == NULL) {
    135                 printf("%s: Failed starting exchange with '%s'.\n", NAME, pathname);
     135                printf(NAME ": Failed starting exchange with '%s'.\n", pathname);
    136136                kbdev_destroy(kbdev);
    137137                return -1;
     
    140140        rc = async_connect_to_me(exch, 0, 0, 0, kbdev_callback_conn, kbdev);
    141141        if (rc != EOK) {
    142                 printf("%s: Failed creating callback connection from '%s'.\n",
    143                     NAME, pathname);
     142                printf(NAME ": Failed creating callback connection from '%s'.\n",
     143                    pathname);
    144144                async_exchange_end(exch);
    145145                kbdev_destroy(kbdev);
     
    193193                        type = IPC_GET_ARG1(call);
    194194                        key = IPC_GET_ARG2(call);
    195                         kbd_push_event(kbdev->kbd_dev, type, key);
     195                        kbd_push_ev(kbdev->kbd_dev, type, key);
    196196                        break;
    197197                default:
  • uspace/srv/hid/input/ctl/pc.c

    r3b2e387 r40f606b  
    4343#include <gsp.h>
    4444
    45 static void pc_ctl_parse(sysarg_t);
     45static void pc_ctl_parse_scancode(int);
    4646static int pc_ctl_init(kbd_dev_t *);
    47 static void pc_ctl_set_ind(kbd_dev_t *, unsigned int);
     47static void pc_ctl_set_ind(kbd_dev_t *, unsigned);
    4848
    4949kbd_ctl_ops_t pc_ctl = {
    50         .parse = pc_ctl_parse,
     50        .parse_scancode = pc_ctl_parse_scancode,
    5151        .init = pc_ctl_init,
    5252        .set_ind = pc_ctl_set_ind
     
    215215}
    216216
    217 static void pc_ctl_parse(sysarg_t scancode)
     217static void pc_ctl_parse_scancode(int scancode)
    218218{
    219219        kbd_event_type_t type;
     
    257257        }
    258258
    259         if ((size_t) scancode >= map_length)
     259        if ((scancode < 0) || ((size_t) scancode >= map_length))
    260260                return;
    261261
    262262        key = map[scancode];
    263263        if (key != 0)
    264                 kbd_push_event(kbd_dev, type, key);
     264                kbd_push_ev(kbd_dev, type, key);
    265265}
    266266
  • uspace/srv/hid/input/ctl/stty.c

    r3b2e387 r40f606b  
    3333/**
    3434 * @file
    35  * @brief Serial TTY-like keyboard controller driver.
     35 * @brief       Serial TTY-like keyboard controller driver.
    3636 */
    3737
     
    4343#include <stroke.h>
    4444
    45 static void stty_ctl_parse(sysarg_t);
     45static void stty_ctl_parse_scancode(int);
    4646static int stty_ctl_init(kbd_dev_t *);
    47 static void stty_ctl_set_ind(kbd_dev_t *, unsigned int);
     47static void stty_ctl_set_ind(kbd_dev_t *, unsigned);
    4848
    4949kbd_ctl_ops_t stty_ctl = {
    50         .parse = stty_ctl_parse,
     50        .parse_scancode = stty_ctl_parse_scancode,
    5151        .init = stty_ctl_init,
    5252        .set_ind = stty_ctl_set_ind
     
    228228}
    229229
    230 static void stty_ctl_parse(sysarg_t scancode)
     230static void stty_ctl_parse_scancode(int scancode)
    231231{
    232232        unsigned mods, key;
  • uspace/srv/hid/input/ctl/sun.c

    r3b2e387 r40f606b  
    3434/**
    3535 * @file
    36  * @brief Sun keyboard controller driver.
     36 * @brief       Sun keyboard controller driver.
    3737 */
    3838
     
    4343#include <kbd_port.h>
    4444
    45 static void sun_ctl_parse(sysarg_t);
     45static void sun_ctl_parse_scancode(int);
    4646static int sun_ctl_init(kbd_dev_t *);
    47 static void sun_ctl_set_ind(kbd_dev_t *, unsigned int);
     47static void sun_ctl_set_ind(kbd_dev_t *, unsigned);
    4848
    4949kbd_ctl_ops_t sun_ctl = {
    50         .parse = sun_ctl_parse,
     50        .parse_scancode = sun_ctl_parse_scancode,
    5151        .init = sun_ctl_init,
    5252        .set_ind = sun_ctl_set_ind
     
    6666}
    6767
    68 static void sun_ctl_parse(sysarg_t scancode)
     68static void sun_ctl_parse_scancode(int scancode)
    6969{
    7070        kbd_event_type_t type;
    7171        unsigned int key;
    7272
    73         if (scancode >= 0x100)
     73        if (scancode < 0 || scancode >= 0x100)
    7474                return;
    7575
     
    8686        key = scanmap_simple[scancode];
    8787        if (key != 0)
    88                 kbd_push_event(kbd_dev, type, key);
     88                kbd_push_ev(kbd_dev, type, key);
    8989}
    9090
  • uspace/srv/hid/input/generic/input.c

    r3b2e387 r40f606b  
    5858#include <kbd_port.h>
    5959#include <kbd_ctl.h>
    60 #include <mouse_proto.h>
    6160#include <layout.h>
    6261#include <mouse.h>
     
    6665
    6766/* In microseconds */
    68 #define DISCOVERY_POLL_INTERVAL  (10 * 1000 * 1000)
    69 
    70 #define NUM_LAYOUTS  3
     67#define DISCOVERY_POLL_INTERVAL         (10*1000*1000)
     68
     69static void kbd_devs_yield(void);
     70static void kbd_devs_reclaim(void);
     71
     72static void input_event_key(int, unsigned int, unsigned, wchar_t);
     73
     74int client_phone = -1;
     75
     76/** List of keyboard devices */
     77static list_t kbd_devs;
     78
     79/** List of mouse devices */
     80list_t mouse_devs;
     81
     82bool irc_service = false;
     83int irc_phone = -1;
     84
     85#define NUM_LAYOUTS 3
    7186
    7287static layout_ops_t *layout[NUM_LAYOUTS] = {
     
    7691};
    7792
    78 static void kbd_devs_yield(void);
    79 static void kbd_devs_reclaim(void);
    80 
    81 int client_phone = -1;
    82 
    83 /** List of keyboard devices */
    84 static list_t kbd_devs;
    85 
    86 /** List of mouse devices */
    87 static list_t mouse_devs;
    88 
    89 bool irc_service = false;
    90 int irc_phone = -1;
    91 
    92 void kbd_push_data(kbd_dev_t *kdev, sysarg_t data)
    93 {
    94         (*kdev->ctl_ops->parse)(data);
    95 }
    96 
    97 void mouse_push_data(mouse_dev_t *mdev, sysarg_t data)
    98 {
    99         (*mdev->proto_ops->parse)(data);
    100 }
    101 
    102 void kbd_push_event(kbd_dev_t *kdev, int type, unsigned int key)
     93void kbd_push_scancode(kbd_dev_t *kdev, int scancode)
     94{
     95/*      printf("scancode: 0x%x\n", scancode);*/
     96        (*kdev->ctl_ops->parse_scancode)(scancode);
     97}
     98
     99void kbd_push_ev(kbd_dev_t *kdev, int type, unsigned int key)
    103100{
    104101        kbd_event_t ev;
    105         unsigned int mod_mask;
    106        
     102        unsigned mod_mask;
     103
    107104        switch (key) {
    108105        case KC_LCTRL: mod_mask = KM_LCTRL; break;
     
    114111        default: mod_mask = 0; break;
    115112        }
    116        
     113
    117114        if (mod_mask != 0) {
    118115                if (type == KEY_PRESS)
     
    121118                        kdev->mods = kdev->mods & ~mod_mask;
    122119        }
    123        
     120
    124121        switch (key) {
    125122        case KC_CAPS_LOCK: mod_mask = KM_CAPS_LOCK; break;
     
    128125        default: mod_mask = 0; break;
    129126        }
    130        
     127
    131128        if (mod_mask != 0) {
    132129                if (type == KEY_PRESS) {
     
    138135                        kdev->mods = kdev->mods ^ (mod_mask & ~kdev->lock_keys);
    139136                        kdev->lock_keys = kdev->lock_keys | mod_mask;
    140                        
     137
    141138                        /* Update keyboard lock indicator lights. */
    142139                        (*kdev->ctl_ops->set_ind)(kdev, kdev->mods);
     
    145142                }
    146143        }
    147        
     144/*
     145        printf("type: %d\n", type);
     146        printf("mods: 0x%x\n", mods);
     147        printf("keycode: %u\n", key);
     148*/
    148149        if (type == KEY_PRESS && (kdev->mods & KM_LCTRL) &&
    149             key == KC_F1) {
     150                key == KC_F1) {
    150151                layout_destroy(kdev->active_layout);
    151152                kdev->active_layout = layout_create(layout[0]);
    152153                return;
    153154        }
    154        
     155
    155156        if (type == KEY_PRESS && (kdev->mods & KM_LCTRL) &&
    156             key == KC_F2) {
     157                key == KC_F2) {
    157158                layout_destroy(kdev->active_layout);
    158159                kdev->active_layout = layout_create(layout[1]);
    159160                return;
    160161        }
    161        
     162
    162163        if (type == KEY_PRESS && (kdev->mods & KM_LCTRL) &&
    163             key == KC_F3) {
     164                key == KC_F3) {
    164165                layout_destroy(kdev->active_layout);
    165166                kdev->active_layout = layout_create(layout[2]);
    166167                return;
    167168        }
    168        
     169
    169170        ev.type = type;
    170171        ev.key = key;
    171172        ev.mods = kdev->mods;
    172        
     173
    173174        ev.c = layout_parse_ev(kdev->active_layout, &ev);
    174         async_obsolete_msg_4(client_phone, INPUT_EVENT_KEY, ev.type, ev.key,
    175             ev.mods, ev.c);
     175        input_event_key(ev.type, ev.key, ev.mods, ev.c);
     176}
     177
     178/** Key has been pressed or released. */
     179static void input_event_key(int type, unsigned int key, unsigned mods,
     180    wchar_t c)
     181{
     182        async_obsolete_msg_4(client_phone, INPUT_EVENT_KEY, type, key,
     183            mods, c);
    176184}
    177185
    178186/** Mouse pointer has moved. */
    179 void mouse_push_event_move(mouse_dev_t *mdev, int dx, int dy)
     187void input_event_move(int dx, int dy)
    180188{
    181189        async_obsolete_msg_2(client_phone, INPUT_EVENT_MOVE, dx, dy);
     
    183191
    184192/** Mouse button has been pressed. */
    185 void mouse_push_event_button(mouse_dev_t *mdev, int bnum, int press)
     193void input_event_button(int bnum, int press)
    186194{
    187195        async_obsolete_msg_2(client_phone, INPUT_EVENT_BUTTON, bnum, press);
     
    193201        ipc_call_t call;
    194202        int retval;
    195        
     203
    196204        async_answer_0(iid, EOK);
    197        
     205
    198206        while (true) {
    199207                callid = async_get_call(&call);
     
    229237                        retval = EINVAL;
    230238                }
    231                
    232239                async_answer_0(callid, retval);
    233         }
     240        }       
    234241}
    235242
    236243static kbd_dev_t *kbd_dev_new(void)
    237244{
    238         kbd_dev_t *kdev = calloc(1, sizeof(kbd_dev_t));
     245        kbd_dev_t *kdev;
     246
     247        kdev = calloc(1, sizeof(kbd_dev_t));
    239248        if (kdev == NULL) {
    240                 printf("%s: Error allocating keyboard device. "
    241                     "Out of memory.\n", NAME);
     249                printf(NAME ": Error allocating keyboard device. "
     250                    "Out of memory.\n");
    242251                return NULL;
    243252        }
    244        
     253
    245254        link_initialize(&kdev->kbd_devs);
    246        
     255
    247256        kdev->mods = KM_NUM_LOCK;
    248257        kdev->lock_keys = 0;
    249258        kdev->active_layout = layout_create(layout[0]);
    250        
     259
    251260        return kdev;
    252 }
    253 
    254 static mouse_dev_t *mouse_dev_new(void)
    255 {
    256         mouse_dev_t *mdev = calloc(1, sizeof(mouse_dev_t));
    257         if (mdev == NULL) {
    258                 printf("%s: Error allocating keyboard device. "
    259                     "Out of memory.\n", NAME);
    260                 return NULL;
    261         }
    262        
    263         link_initialize(&mdev->mouse_devs);
    264        
    265         return mdev;
    266261}
    267262
     
    269264static void kbd_add_dev(kbd_port_ops_t *port, kbd_ctl_ops_t *ctl)
    270265{
    271         kbd_dev_t *kdev = kbd_dev_new();
     266        kbd_dev_t *kdev;
     267
     268        kdev = kbd_dev_new();
    272269        if (kdev == NULL)
    273270                return;
    274        
     271
    275272        kdev->port_ops = port;
    276273        kdev->ctl_ops = ctl;
    277274        kdev->dev_path = NULL;
    278        
     275
    279276        /* Initialize port driver. */
    280277        if ((*kdev->port_ops->init)(kdev) != 0)
    281278                goto fail;
    282        
     279
    283280        /* Initialize controller driver. */
    284281        if ((*kdev->ctl_ops->init)(kdev) != 0) {
     
    286283                goto fail;
    287284        }
    288        
     285
    289286        list_append(&kdev->kbd_devs, &kbd_devs);
    290287        return;
    291        
    292288fail:
    293289        free(kdev);
    294290}
    295291
    296 /** Add new legacy mouse device. */
    297 static void mouse_add_dev(mouse_port_ops_t *port, mouse_proto_ops_t *proto)
    298 {
    299         mouse_dev_t *mdev = mouse_dev_new();
    300         if (mdev == NULL)
    301                 return;
    302        
    303         mdev->port_ops = port;
    304         mdev->proto_ops = proto;
    305         mdev->dev_path = NULL;
    306        
    307         /* Initialize port driver. */
    308         if ((*mdev->port_ops->init)(mdev) != 0)
    309                 goto fail;
    310        
    311         /* Initialize protocol driver. */
    312         if ((*mdev->proto_ops->init)(mdev) != 0) {
    313                 /* XXX Uninit port */
    314                 goto fail;
    315         }
    316        
    317         list_append(&mdev->mouse_devs, &mouse_devs);
    318         return;
    319        
    320 fail:
    321         free(mdev);
    322 }
    323 
    324292/** Add new kbdev device.
    325293 *
    326  * @param dev_path Filesystem path to the device (/dev/class/...)
    327  *
     294 * @param dev_path      Filesystem path to the device (/dev/class/...)
    328295 */
    329296static int kbd_add_kbdev(const char *dev_path)
    330297{
    331         kbd_dev_t *kdev = kbd_dev_new();
     298        kbd_dev_t *kdev;
     299
     300        kdev = kbd_dev_new();
    332301        if (kdev == NULL)
    333302                return -1;
    334        
     303
    335304        kdev->dev_path = dev_path;
    336305        kdev->port_ops = NULL;
    337306        kdev->ctl_ops = &kbdev_ctl;
    338        
     307
    339308        /* Initialize controller driver. */
    340309        if ((*kdev->ctl_ops->init)(kdev) != 0) {
    341310                goto fail;
    342311        }
    343        
     312
    344313        list_append(&kdev->kbd_devs, &kbd_devs);
    345314        return EOK;
    346        
    347315fail:
    348316        free(kdev);
    349         return -1;
    350 }
    351 
    352 /** Add new mousedev device.
    353  *
    354  * @param dev_path Filesystem path to the device (/dev/class/...)
    355  *
    356  */
    357 static int mouse_add_mousedev(const char *dev_path)
    358 {
    359         mouse_dev_t *mdev = mouse_dev_new();
    360         if (mdev == NULL)
    361                 return -1;
    362        
    363         mdev->dev_path = dev_path;
    364         mdev->port_ops = NULL;
    365         mdev->proto_ops = &mousedev_proto;
    366        
    367         /* Initialize controller driver. */
    368         if ((*mdev->proto_ops->init)(mdev) != 0) {
    369                 goto fail;
    370         }
    371        
    372         list_append(&mdev->mouse_devs, &mouse_devs);
    373         return EOK;
    374        
    375 fail:
    376         free(mdev);
    377317        return -1;
    378318}
     
    435375}
    436376
    437 /** Add legacy drivers/devices. */
    438 static void mouse_add_legacy_devs(void)
    439 {
    440         /*
    441          * Need to add these drivers based on config unless we can probe
    442          * them automatically.
    443          */
    444 #if defined(UARCH_amd64)
    445         mouse_add_dev(&chardev_mouse_port, &ps2_proto);
    446 #endif
    447 #if defined(UARCH_ia32)
    448         mouse_add_dev(&chardev_mouse_port, &ps2_proto);
    449 #endif
    450 #if defined(MACHINE_i460GX)
    451         mouse_add_dev(&chardev_mouse_port, &ps2_proto);
    452 #endif
    453 #if defined(UARCH_ppc32)
    454         mouse_add_dev(&adb_mouse_port, &adb_proto);
    455 #endif
    456         /* Silence warning on abs32le about mouse_add_dev() being unused */
    457         (void) mouse_add_dev;
    458 }
    459 
    460377static void kbd_devs_yield(void)
    461378{
     
    464381                kbd_dev_t *kdev = list_get_instance(kdev_link, kbd_dev_t,
    465382                    kbd_devs);
    466                
     383
    467384                /* Yield port */
    468385                if (kdev->port_ops != NULL)
     
    477394                kbd_dev_t *kdev = list_get_instance(kdev_link, kbd_dev_t,
    478395                    kbd_devs);
    479                
     396
    480397                /* Reclaim port */
    481398                if (kdev->port_ops != NULL)
     
    488405 * Looks under /dev/class/keyboard and /dev/class/mouse.
    489406 *
    490  * @param arg Ignored
    491  *
     407 * @param arg   Ignored
    492408 */
    493409static int dev_discovery_fibril(void *arg)
     
    497413        size_t mouse_id = 1;
    498414        int rc;
    499        
     415
    500416        while (true) {
    501417                async_usleep(DISCOVERY_POLL_INTERVAL);
    502                
     418
    503419                /*
    504420                 * Check for new keyboard device
     
    507423                if (rc < 0)
    508424                        continue;
    509                
     425
    510426                if (kbd_add_kbdev(dev_path) == EOK) {
    511                         printf("%s: Connected keyboard device '%s'\n",
    512                             NAME, dev_path);
    513                        
     427                        printf(NAME ": Connected keyboard device '%s'\n",
     428                            dev_path);
     429
    514430                        /* XXX Handle device removal */
    515431                        ++kbd_id;
    516432                }
    517                
     433
    518434                free(dev_path);
    519                
     435
    520436                /*
    521437                 * Check for new mouse device
     
    524440                if (rc < 0)
    525441                        continue;
    526                
    527                 if (mouse_add_mousedev(dev_path) == EOK) {
    528                         printf("%s: Connected mouse device '%s'\n",
    529                             NAME, dev_path);
    530                        
     442
     443                if (mouse_add_dev(dev_path) == EOK) {
     444                        printf(NAME ": Connected mouse device '%s'\n",
     445                            dev_path);
     446
    531447                        /* XXX Handle device removal */
    532448                        ++mouse_id;
    533449                }
    534                
     450
    535451                free(dev_path);
    536452        }
    537        
     453
    538454        return EOK;
    539455}
     
    542458static void input_start_dev_discovery(void)
    543459{
    544         fid_t fid = fibril_create(dev_discovery_fibril, NULL);
     460        fid_t fid;
     461
     462        fid = fibril_create(dev_discovery_fibril, NULL);
    545463        if (!fid) {
    546                 printf("%s: Failed to create device discovery fibril.\n",
    547                     NAME);
     464                printf(NAME ": Failed to create device discovery fibril.\n");
    548465                return;
    549466        }
    550        
     467
    551468        fibril_add_ready(fid);
    552469}
     
    573490        /* Add legacy keyboard devices. */
    574491        kbd_add_legacy_devs();
    575        
    576         /* Add legacy mouse devices. */
    577         mouse_add_legacy_devs();
     492
     493        /* Add legacy (devmap-style) mouse device. */
     494        (void) mouse_add_dev("/dev/hid_in/mouse");
    578495       
    579496        /* Register driver */
     
    592509                return -1;
    593510        }
    594        
     511
    595512        /* Start looking for new input devices */
    596513        input_start_dev_discovery();
    597        
    598         printf("%s: Accepting connections\n", NAME);
     514
     515        printf(NAME ": Accepting connections\n");
    599516        async_manager();
    600        
     517
    601518        /* Not reached. */
    602519        return 0;
  • uspace/srv/hid/input/generic/layout.c

    r3b2e387 r40f606b  
    4848        layout = calloc(1, sizeof(layout_t));
    4949        if (layout == NULL) {
    50                 printf("%s: Out of memory.\n", NAME);
     50                printf(NAME ": Out of memory.\n");
    5151                return NULL;
    5252        }
  • uspace/srv/hid/input/generic/stroke.c

    r3b2e387 r40f606b  
    6060        while (mods_keys[i][0] != 0) {
    6161                if (mod & mods_keys[i][0]) {
    62                         kbd_push_event(kdev, KEY_PRESS, mods_keys[i][1]);
     62                        kbd_push_ev(kdev, KEY_PRESS, mods_keys[i][1]);
    6363                }
    6464                ++i;
     
    6767        /* Simulate key press and release. */
    6868        if (key != 0) {
    69                 kbd_push_event(kdev, KEY_PRESS, key);
    70                 kbd_push_event(kdev, KEY_RELEASE, key);
     69                kbd_push_ev(kdev, KEY_PRESS, key);
     70                kbd_push_ev(kdev, KEY_RELEASE, key);
    7171        }
    7272
     
    7575        while (mods_keys[i][0] != 0) {
    7676                if (mod & mods_keys[i][0]) {
    77                         kbd_push_event(kdev, KEY_RELEASE, mods_keys[i][1]);
     77                        kbd_push_ev(kdev, KEY_RELEASE, mods_keys[i][1]);
    7878                }
    7979                ++i;
  • uspace/srv/hid/input/include/input.h

    r3b2e387 r40f606b  
    4242
    4343#define NAME       "input"
    44 #define NAMESPACE  "hid"
     44#define NAMESPACE  "hid_in"
    4545
    4646extern bool irc_service;
    4747extern int irc_phone;
     48
     49extern list_t mouse_devs;
     50
     51void input_event_move(int, int);
     52void input_event_button(int bnum, int press);
    4853
    4954#endif
  • uspace/srv/hid/input/include/kbd.h

    r3b2e387 r40f606b  
    7171} kbd_dev_t;
    7272
    73 extern void kbd_push_data(kbd_dev_t *, sysarg_t);
    74 extern void kbd_push_event(kbd_dev_t *, int, unsigned int);
     73extern void kbd_push_scancode(kbd_dev_t *, int);
     74extern void kbd_push_ev(kbd_dev_t *, int, unsigned int);
    7575
    7676#endif
  • uspace/srv/hid/input/include/kbd_ctl.h

    r3b2e387 r40f606b  
    2828
    2929/** @addtogroup inputgen generic
    30  * @brief Keyboard controller driver interface.
    31  * @ingroup input
     30 * @brief       Keyboard controller driver interface.
     31 * @ingroup  input
    3232 * @{
    3333 */
     
    4343
    4444typedef struct kbd_ctl_ops {
    45         void (*parse)(sysarg_t);
     45        void (*parse_scancode)(int);
    4646        int (*init)(struct kbd_dev *);
    47         void (*set_ind)(struct kbd_dev *, unsigned int);
     47        void (*set_ind)(struct kbd_dev *, unsigned);
    4848} kbd_ctl_ops_t;
    4949
     
    5959/**
    6060 * @}
    61  */
     61 */
     62
  • uspace/srv/hid/input/include/kbd_port.h

    r3b2e387 r40f606b  
    2828
    2929/** @addtogroup inputgen generic
    30  * @brief Keyboard port driver interface.
    31  * @ingroup input
     30 * @brief       Keyboard port driver interface.
     31 * @ingroup  input
    3232 * @{
    3333 */
     
    5151extern kbd_port_ops_t adb_port;
    5252extern kbd_port_ops_t chardev_port;
     53extern kbd_port_ops_t dummy_port;
    5354extern kbd_port_ops_t gxemul_port;
    5455extern kbd_port_ops_t msim_port;
     
    6465/**
    6566 * @}
    66  */
     67 */
     68
  • uspace/srv/hid/input/include/mouse.h

    r3b2e387 r40f606b  
    4040#include <adt/list.h>
    4141
    42 struct mouse_port_ops;
    43 struct mouse_proto_ops;
    44 
    4542typedef struct mouse_dev {
    4643        /** Link to mouse_devs list */
    4744        link_t mouse_devs;
    48        
    49         /** Path to the device (only for mouseev devices) */
     45
     46        /** Path to the device */
    5047        const char *dev_path;
    51        
    52         /** Port ops */
    53         struct mouse_port_ops *port_ops;
    54        
    55         /** Protocol ops */
    56         struct mouse_proto_ops *proto_ops;
    5748} mouse_dev_t;
    5849
    59 extern void mouse_push_data(mouse_dev_t *, sysarg_t);
    60 extern void mouse_push_event_move(mouse_dev_t *, int, int);
    61 extern void mouse_push_event_button(mouse_dev_t *, int, int);
     50int mouse_add_dev(const char *dev_path);
    6251
    6352#endif
  • uspace/srv/hid/input/layout/cz.c

    r3b2e387 r40f606b  
    391391        cz_state = malloc(sizeof(layout_cz_t));
    392392        if (cz_state == NULL) {
    393                 printf("%s: Out of memory.\n", NAME);
     393                printf(NAME ": Out of memory.\n");
    394394                return ENOMEM;
    395395        }
  • uspace/srv/hid/input/port/adb.c

    r3b2e387 r40f606b  
    9393        async_exchange_end(exch);
    9494        if (rc != EOK) {
    95                 printf("%s: Failed to create callback from device\n", NAME);
     95                printf(NAME ": Failed to create callback from device\n");
    9696                async_hangup(dev_sess);
    9797                return rc;
     
    142142static void adb_kbd_reg0_data(uint16_t data)
    143143{
    144         uint8_t b0 = (data >> 8) & 0xff;
    145         uint8_t b1 = data & 0xff;
    146        
     144        uint8_t b0, b1;
     145
     146        b0 = (data >> 8) & 0xff;
     147        b1 = data & 0xff;
     148
    147149        if (b0 != 0xff)
    148                 kbd_push_data(kbd_dev, b0);
    149        
     150                kbd_push_scancode(kbd_dev, b0);
    150151        if (b1 != 0xff)
    151                 kbd_push_data(kbd_dev, b1);
     152                kbd_push_scancode(kbd_dev, b1);
    152153}
    153154
  • uspace/srv/hid/input/port/chardev.c

    r3b2e387 r40f606b  
    108108       
    109109        if (rc != 0) {
    110                 printf("%s: Failed to create callback from device\n", NAME);
     110                printf(NAME ": Failed to create callback from device\n");
    111111                async_hangup(dev_sess);
    112112                return -1;
     
    153153                switch (IPC_GET_IMETHOD(call)) {
    154154                case CHAR_NOTIF_BYTE:
    155                         kbd_push_data(kbd_dev, IPC_GET_ARG1(call));
     155                        kbd_push_scancode(kbd_dev, IPC_GET_ARG1(call));
    156156                        break;
    157157                default:
  • uspace/srv/hid/input/port/gxemul.c

    r3b2e387 r40f606b  
    108108
    109109/** Process data sent when a key is pressed.
     110 * 
     111 *  @param keybuffer Buffer of pressed keys.
     112 *  @param call      IPC call.
    110113 *
    111  * @param keybuffer Buffer of pressed keys.
    112  * @param call      IPC call.
    113  *
     114 *  @return Always 1.
    114115 */
    115116static void gxemul_irq_handler(ipc_callid_t iid, ipc_call_t *call)
    116117{
    117         kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
     118        int scan_code = IPC_GET_ARG2(*call);
     119
     120        kbd_push_scancode(kbd_dev, scan_code);
    118121}
    119122
  • uspace/srv/hid/input/port/msim.c

    r3b2e387 r40f606b  
    109109static void msim_irq_handler(ipc_callid_t iid, ipc_call_t *call)
    110110{
    111         kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
     111        int scan_code = IPC_GET_ARG2(*call);
     112        kbd_push_scancode(kbd_dev, scan_code);
    112113}
    113114
    114115/** @}
    115  */
     116*/
  • uspace/srv/hid/input/port/niagara.c

    r3b2e387 r40f606b  
    148148                c = input_buffer->data[input_buffer->read_ptr];
    149149                input_buffer->read_ptr =
    150                     ((input_buffer->read_ptr) + 1) % INPUT_BUFFER_SIZE;
    151                 kbd_push_data(kbd_dev, c);
     150                        ((input_buffer->read_ptr) + 1) % INPUT_BUFFER_SIZE;
     151                kbd_push_scancode(kbd_dev, c);
    152152        }
    153153}
  • uspace/srv/hid/input/port/ns16550.c

    r3b2e387 r40f606b  
    156156static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call)
    157157{
    158         kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
     158        int scan_code = IPC_GET_ARG2(*call);
     159        kbd_push_scancode(kbd_dev, scan_code);
    159160       
    160161        if (irc_service)
  • uspace/srv/hid/input/port/pl050.c

    r3b2e387 r40f606b  
    137137static void pl050_irq_handler(ipc_callid_t iid, ipc_call_t *call)
    138138{
    139         kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
     139        int scan_code = IPC_GET_ARG2(*call);
     140
     141        kbd_push_scancode(kbd_dev, scan_code);
     142        return;
    140143}
    141144
    142145/**
    143146 * @}
    144  */
     147 */ 
  • uspace/srv/hid/input/port/sgcn.c

    r3b2e387 r40f606b  
    183183                *in_rdptr_ptr = (((*in_rdptr_ptr) - begin + 1) % size) + begin;
    184184                buf_ptr = (volatile char *)
    185                     SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr);
    186                 kbd_push_data(kbd_dev, c);
     185                        SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr);
     186                kbd_push_scancode(kbd_dev, c);
    187187        }
    188188}
  • uspace/srv/hid/input/port/ski.c

    r3b2e387 r40f606b  
    110110                        if (c == 0)
    111111                                break;
    112                         kbd_push_data(kbd_dev, c);
     112                        kbd_push_scancode(kbd_dev, c);
    113113                }
    114114
  • uspace/srv/hid/input/port/z8530.c

    r3b2e387 r40f606b  
    142142static void z8530_irq_handler(ipc_callid_t iid, ipc_call_t *call)
    143143{
    144         kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
     144        int scan_code = IPC_GET_ARG2(*call);
     145        kbd_push_scancode(kbd_dev, scan_code);
    145146       
    146147        if (irc_service)
  • uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c

    r3b2e387 r40f606b  
    4242#include <io/console.h>
    4343#include <vfs/vfs.h>
    44 #include <ipc/mouseev.h>
     44#include <ipc/mouse.h>
    4545#include <async.h>
    4646#include <async_obsolete.h>
     
    5757
    5858#define NAME "s3c24ser"
    59 #define NAMESPACE "hid"
     59#define NAMESPACE "hid_in"
    6060
    6161static irq_cmd_t ts_irq_cmds[] = {
     
    284284        button = 1;
    285285        press = 0;
    286         async_obsolete_msg_2(ts->client_phone, MOUSEEV_BUTTON_EVENT, button, press);
     286        async_obsolete_msg_2(ts->client_phone, MEVENT_BUTTON, button, press);
    287287
    288288        s3c24xx_ts_wait_for_int_mode(ts, updn_down);
     
    325325
    326326        /* Send notifications to client. */
    327         async_obsolete_msg_2(ts->client_phone, MOUSEEV_MOVE_EVENT, dx, dy);
    328         async_obsolete_msg_2(ts->client_phone, MOUSEEV_BUTTON_EVENT, button, press);
     327        async_obsolete_msg_2(ts->client_phone, MEVENT_MOVE, dx, dy);
     328        async_obsolete_msg_2(ts->client_phone, MEVENT_BUTTON, button, press);
    329329
    330330        ts->last_x = x_pos;
Note: See TracChangeset for help on using the changeset viewer.