Changeset 79ae36dd in mainline for uspace/srv/hid


Ignore:
Timestamp:
2011-06-08T19:01:55Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0eff68e
Parents:
764d71e
Message:

new async framework with integrated exchange tracking

  • strict isolation between low-level IPC and high-level async framework with integrated exchange tracking
    • each IPC connection is represented by an async_sess_t structure
    • each IPC exchange is represented by an async_exch_t structure
    • exchange management is either based on atomic messages (EXCHANGE_ATOMIC), locking (EXCHANGE_SERIALIZE) or connection cloning (EXCHANGE_CLONE)
  • async_obsolete: temporary compatibility layer to keep old async clients working (several pieces of code are currently broken, but only non-essential functionality)
  • IPC_M_PHONE_HANGUP is now method no. 0 (for elegant boolean evaluation)
  • IPC_M_DEBUG_ALL has been renamed to IPC_M_DEBUG
  • IPC_M_PING has been removed (VFS protocol now has VFS_IN_PING)
  • console routines in libc have been rewritten for better abstraction
  • additional use for libc-private header files (FILE structure opaque to the client)
  • various cstyle changes (typos, indentation, missing externs in header files, improved comments, etc.)
Location:
uspace/srv/hid
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/adb_mouse/adb_dev.c

    r764d71e r79ae36dd  
    3939#include <fcntl.h>
    4040#include <errno.h>
     41#include <devmap.h>
     42#include <devmap_obsolete.h>
     43#include <async.h>
     44#include <async_obsolete.h>
     45#include <kernel/ipc/ipc_methods.h>
    4146
    4247#include "adb_mouse.h"
     
    4550static void adb_dev_events(ipc_callid_t iid, ipc_call_t *icall);
    4651
    47 static int dev_phone;
    48 
    4952int adb_dev_init(void)
    5053{
    51         const char *input = "/dev/adb/mouse";
    52         int input_fd;
    53 
    54         printf(NAME ": open %s\n", input);
    55 
    56         input_fd = open(input, O_RDONLY);
    57         if (input_fd < 0) {
    58                 printf(NAME ": Failed opening %s (%d)\n", input, input_fd);
    59                 return false;
     54        devmap_handle_t handle;
     55        int rc = devmap_device_get_handle("adb/mouse", &handle,
     56            IPC_FLAG_BLOCKING);
     57       
     58        if (rc != EOK) {
     59                printf("%s: Failed resolving ADB\n", NAME);
     60                return rc;
    6061        }
    61 
    62         dev_phone = fd_phone(input_fd);
     62       
     63        int dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING);
    6364        if (dev_phone < 0) {
    64                 printf(NAME ": Failed to connect to device\n");
    65                 return false;
     65                printf("%s: Failed connecting to ADB\n", NAME);
     66                return ENOENT;
    6667        }
    67 
     68       
    6869        /* NB: The callback connection is slotted for removal */
    69         if (async_connect_to_me(dev_phone, 0, 0, 0, adb_dev_events) != 0) {
     70        if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, adb_dev_events) != 0) {
    7071                printf(NAME ": Failed to create callback from device\n");
    7172                return false;
     
    8485
    8586                int retval;
     87               
     88                if (!IPC_GET_IMETHOD(call)) {
     89                        /* TODO: Handle hangup */
     90                        return;
     91                }
    8692
    8793                switch (IPC_GET_IMETHOD(call)) {
    88                 case IPC_M_PHONE_HUNGUP:
    89                         /* TODO: Handle hangup */
    90                         return;
    9194                case IPC_FIRST_USER_METHOD:
    9295                        mouse_handle_data(IPC_GET_ARG1(call));
  • uspace/srv/hid/adb_mouse/adb_mouse.c

    r764d71e r79ae36dd  
    4343#include <stdlib.h>
    4444#include <async.h>
     45#include <async_obsolete.h>
    4546#include <errno.h>
    4647#include <devmap.h>
    47 
    4848#include "adb_mouse.h"
    4949#include "adb_dev.h"
     50
     51// FIXME: remove this header
     52#include <kernel/ipc/ipc_methods.h>
    5053
    5154static void client_connection(ipc_callid_t iid, ipc_call_t *icall);
     
    101104        while (1) {
    102105                callid = async_get_call(&call);
    103                 switch (IPC_GET_IMETHOD(call)) {
    104                 case IPC_M_PHONE_HUNGUP:
     106               
     107                if (!IPC_GET_IMETHOD(call)) {
    105108                        if (client_phone != -1) {
    106                                 async_hangup(client_phone);
     109                                async_obsolete_hangup(client_phone);
    107110                                client_phone = -1;
    108111                        }
     
    110113                        async_answer_0(callid, EOK);
    111114                        return;
     115                }
     116               
     117                switch (IPC_GET_IMETHOD(call)) {
    112118                case IPC_M_CONNECT_TO_ME:
    113119                        if (client_phone != -1) {
     
    158164{
    159165        if (client_phone != -1) {
    160                 async_msg_2(client_phone, MEVENT_BUTTON, button, press);
     166                async_obsolete_msg_2(client_phone, MEVENT_BUTTON, button, press);
    161167        }
    162168}
     
    165171{
    166172        if (client_phone != -1)
    167                 async_msg_2(client_phone, MEVENT_MOVE, dx, dy);
     173                async_obsolete_msg_2(client_phone, MEVENT_MOVE, dx, dy);
    168174}
    169175
  • uspace/srv/hid/char_mouse/char_mouse.c

    r764d71e r79ae36dd  
    4343#include <stdlib.h>
    4444#include <async.h>
     45#include <async_obsolete.h>
    4546#include <errno.h>
    4647#include <devmap.h>
    47 
    4848#include <char_mouse.h>
    4949#include <mouse_port.h>
    5050#include <mouse_proto.h>
     51
     52// FIXME: remove this header
     53#include <kernel/ipc/ipc_methods.h>
    5154
    5255#define NAME       "mouse"
     
    6568/*      printf("ev_btn: button %d, press %d\n", button, press);*/
    6669        if (client_phone != -1) {
    67                 async_msg_2(client_phone, MEVENT_BUTTON, button, press);
     70                async_obsolete_msg_2(client_phone, MEVENT_BUTTON, button, press);
    6871        }
    6972}
     
    7376/*      printf("ev_move: dx %d, dy %d\n", dx, dy);*/
    7477        if (client_phone != -1)
    75                 async_msg_2(client_phone, MEVENT_MOVE, dx, dy);
     78                async_obsolete_msg_2(client_phone, MEVENT_MOVE, dx, dy);
    7679}
    7780
     
    8689        while (1) {
    8790                callid = async_get_call(&call);
    88                 switch (IPC_GET_IMETHOD(call)) {
    89                 case IPC_M_PHONE_HUNGUP:
     91               
     92                if (!IPC_GET_IMETHOD(call)) {
    9093                        if (client_phone != -1) {
    91                                 async_hangup(client_phone);
     94                                async_obsolete_hangup(client_phone);
    9295                                client_phone = -1;
    9396                        }
     
    9598                        async_answer_0(callid, EOK);
    9699                        return;
     100                }
     101               
     102                switch (IPC_GET_IMETHOD(call)) {
    97103                case IPC_M_CONNECT_TO_ME:
    98104                        if (client_phone != -1) {
  • uspace/srv/hid/char_mouse/chardev.c

    r764d71e r79ae36dd  
    3636#include <ipc/char.h>
    3737#include <async.h>
     38#include <async_obsolete.h>
    3839#include <vfs/vfs.h>
    3940#include <fcntl.h>
    4041#include <errno.h>
    41 
     42#include <devmap.h>
     43#include <devmap_obsolete.h>
    4244#include <char_mouse.h>
    4345#include <mouse_port.h>
     
    5153int mouse_port_init(void)
    5254{
    53         const char *input = "/dev/char/ps2b";
    54         int input_fd;
    55 
    56         printf(NAME ": open %s\n", input);
    57 
    58         input_fd = open(input, O_RDONLY);
    59         if (input_fd < 0) {
    60                 printf(NAME ": Failed opening %s (%d)\n", input, input_fd);
    61                 return false;
     55        devmap_handle_t handle;
     56        int rc = devmap_device_get_handle("char/ps2b", &handle,
     57            IPC_FLAG_BLOCKING);
     58       
     59        if (rc != EOK) {
     60                printf("%s: Failed resolving PS/2\n", NAME);
     61                return rc;
    6262        }
    63 
    64         dev_phone = fd_phone(input_fd);
     63       
     64        dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING);
    6565        if (dev_phone < 0) {
    66                 printf(NAME ": Failed to connect to device\n");
    67                 return false;
     66                printf("%s: Failed connecting to PS/2\n", NAME);
     67                return ENOENT;
    6868        }
    69 
     69       
    7070        /* NB: The callback connection is slotted for removal */
    71         if (async_connect_to_me(dev_phone, 0, 0, 0, chardev_events) != 0) {
     71        if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, chardev_events) != 0) {
    7272                printf(NAME ": Failed to create callback from device\n");
    7373                return false;
    7474        }
    75 
     75       
    7676        return 0;
    7777}
     
    8787void mouse_port_write(uint8_t data)
    8888{
    89         async_msg_1(dev_phone, CHAR_WRITE_BYTE, data);
     89        async_obsolete_msg_1(dev_phone, CHAR_WRITE_BYTE, data);
    9090}
    9191
     
    9999
    100100                int retval;
     101               
     102                if (!IPC_GET_IMETHOD(call)) {
     103                        /* TODO: Handle hangup */
     104                        return;
     105                }
    101106
    102107                switch (IPC_GET_IMETHOD(call)) {
    103                 case IPC_M_PHONE_HUNGUP:
    104                         /* TODO: Handle hangup */
    105                         return;
    106108                case IPC_FIRST_USER_METHOD:
    107109                        mouse_handle_byte(IPC_GET_ARG1(call));
  • uspace/srv/hid/console/console.c

    r764d71e r79ae36dd  
    3939#include <ipc/fb.h>
    4040#include <ipc/services.h>
    41 #include <ipc/ns.h>
     41#include <ns.h>
     42#include <ns_obsolete.h>
    4243#include <errno.h>
    4344#include <str_error.h>
     
    4546#include <unistd.h>
    4647#include <async.h>
     48#include <async_obsolete.h>
    4749#include <adt/fifo.h>
    4850#include <sys/mman.h>
     
    5254#include <event.h>
    5355#include <devmap.h>
     56#include <devmap_obsolete.h>
    5457#include <fcntl.h>
    5558#include <vfs/vfs.h>
     
    6366#include "keybuffer.h"
    6467
     68// FIXME: remove this header
     69#include <kernel/ipc/ipc_methods.h>
    6570
    6671#define NAME       "console"
    6772#define NAMESPACE  "term"
     73
    6874/** Interval for checking for new keyboard (1/4s). */
    6975#define HOTPLUG_WATCH_INTERVAL (1000 * 250)
     
    7177/* Kernel defines 32 but does not export it. */
    7278#define MAX_IPC_OUTGOING_PHONES 128
     79
    7380/** To allow proper phone closing. */
    7481static ipc_callid_t driver_phones[MAX_IPC_OUTGOING_PHONES] = { 0 };
     
    97104} console_t;
    98105
    99 
    100 
    101106/** Array of data for virtual consoles */
    102107static console_t consoles[CONSOLE_COUNT];
     
    122127static void curs_visibility(bool visible)
    123128{
    124         async_msg_1(fb_info.phone, FB_CURSOR_VISIBILITY, visible);
     129        async_obsolete_msg_1(fb_info.phone, FB_CURSOR_VISIBILITY, visible);
    125130}
    126131
    127132static void curs_hide_sync(void)
    128133{
    129         async_req_1_0(fb_info.phone, FB_CURSOR_VISIBILITY, false);
     134        async_obsolete_req_1_0(fb_info.phone, FB_CURSOR_VISIBILITY, false);
    130135}
    131136
    132137static void curs_goto(sysarg_t x, sysarg_t y)
    133138{
    134         async_msg_2(fb_info.phone, FB_CURSOR_GOTO, x, y);
     139        async_obsolete_msg_2(fb_info.phone, FB_CURSOR_GOTO, x, y);
    135140}
    136141
    137142static void screen_clear(void)
    138143{
    139         async_msg_0(fb_info.phone, FB_CLEAR);
     144        async_obsolete_msg_0(fb_info.phone, FB_CLEAR);
    140145}
    141146
    142147static void screen_yield(void)
    143148{
    144         async_req_0_0(fb_info.phone, FB_SCREEN_YIELD);
     149        async_obsolete_req_0_0(fb_info.phone, FB_SCREEN_YIELD);
    145150}
    146151
    147152static void screen_reclaim(void)
    148153{
    149         async_req_0_0(fb_info.phone, FB_SCREEN_RECLAIM);
     154        async_obsolete_req_0_0(fb_info.phone, FB_SCREEN_RECLAIM);
    150155}
    151156
    152157static void kbd_yield(void)
    153158{
    154         async_req_0_0(kbd_phone, KBD_YIELD);
     159        async_obsolete_req_0_0(kbd_phone, KBD_YIELD);
    155160}
    156161
    157162static void kbd_reclaim(void)
    158163{
    159         async_req_0_0(kbd_phone, KBD_RECLAIM);
     164        async_obsolete_req_0_0(kbd_phone, KBD_RECLAIM);
    160165}
    161166
    162167static void set_style(uint8_t style)
    163168{
    164         async_msg_1(fb_info.phone, FB_SET_STYLE, style);
     169        async_obsolete_msg_1(fb_info.phone, FB_SET_STYLE, style);
    165170}
    166171
    167172static void set_color(uint8_t fgcolor, uint8_t bgcolor, uint8_t flags)
    168173{
    169         async_msg_3(fb_info.phone, FB_SET_COLOR, fgcolor, bgcolor, flags);
     174        async_obsolete_msg_3(fb_info.phone, FB_SET_COLOR, fgcolor, bgcolor, flags);
    170175}
    171176
    172177static void set_rgb_color(uint32_t fgcolor, uint32_t bgcolor)
    173178{
    174         async_msg_2(fb_info.phone, FB_SET_RGB_COLOR, fgcolor, bgcolor);
     179        async_obsolete_msg_2(fb_info.phone, FB_SET_RGB_COLOR, fgcolor, bgcolor);
    175180}
    176181
     
    227232                }
    228233               
    229                 async_req_4_0(fb_info.phone, FB_DRAW_TEXT_DATA,
     234                async_obsolete_req_4_0(fb_info.phone, FB_DRAW_TEXT_DATA,
    230235                    x0, y0, width, height);
    231236        }
     
    268273static void fb_putchar(wchar_t c, sysarg_t col, sysarg_t row)
    269274{
    270         async_msg_3(fb_info.phone, FB_PUTCHAR, c, col, row);
     275        async_obsolete_msg_3(fb_info.phone, FB_PUTCHAR, c, col, row);
    271276}
    272277
     
    317322               
    318323                if (cons == active_console)
    319                         async_msg_1(fb_info.phone, FB_SCROLL, 1);
     324                        async_obsolete_msg_1(fb_info.phone, FB_SCROLL, 1);
    320325        }
    321326       
     
    328333static void change_console(console_t *cons)
    329334{
    330         if (cons == active_console) {
     335        if (cons == active_console)
    331336                return;
    332         }
    333337       
    334338        fb_pending_flush();
    335339       
    336340        if (cons == kernel_console) {
    337                 async_serialize_start();
     341                async_obsolete_serialize_start();
    338342                curs_hide_sync();
    339343                gcons_in_kernel();
    340344                screen_yield();
    341345                kbd_yield();
    342                 async_serialize_end();
     346                async_obsolete_serialize_end();
    343347               
    344348                if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE)) {
     
    350354       
    351355        if (cons != kernel_console) {
    352                 async_serialize_start();
     356                async_obsolete_serialize_start();
    353357               
    354358                if (active_console == kernel_console) {
     
    377381                       
    378382                        /* This call can preempt, but we are already at the end */
    379                         rc = async_req_4_0(fb_info.phone, FB_DRAW_TEXT_DATA,
     383                        rc = async_obsolete_req_4_0(fb_info.phone, FB_DRAW_TEXT_DATA,
    380384                            0, 0, cons->scr.size_x,
    381385                            cons->scr.size_y);
     
    405409                curs_visibility(cons->scr.is_cursor_visible);
    406410               
    407                 async_serialize_end();
     411                async_obsolete_serialize_end();
    408412        }
    409413}
     
    416420                        printf("Device %" PRIxn " gone.\n", hash);
    417421                        driver_phones[i] = 0;
    418                         async_hangup(i);
     422                        async_obsolete_hangup(i);
    419423                        return;
    420424                }
     
    431435               
    432436                int retval;
    433                 console_event_t ev;
    434                
    435                 switch (IPC_GET_IMETHOD(call)) {
    436                 case IPC_M_PHONE_HUNGUP:
     437                kbd_event_t ev;
     438               
     439                if (!IPC_GET_IMETHOD(call)) {
    437440                        /* TODO: Handle hangup */
    438441                        close_driver_phone(iid);
    439442                        return;
     443                }
     444               
     445                switch (IPC_GET_IMETHOD(call)) {
    440446                case KBD_EVENT:
    441447                        /* Got event from keyboard driver. */
     
    477483                int retval;
    478484               
    479                 switch (IPC_GET_IMETHOD(call)) {
    480                 case IPC_M_PHONE_HUNGUP:
     485                if (!IPC_GET_IMETHOD(call)) {
    481486                        /* TODO: Handle hangup */
    482487                        close_driver_phone(iid);
    483488                        return;
     489                }
     490               
     491                switch (IPC_GET_IMETHOD(call)) {
    484492                case MEVENT_BUTTON:
    485493                        if (IPC_GET_ARG1(call) == 1) {
    486494                                int newcon = gcons_mouse_btn((bool) IPC_GET_ARG2(call));
    487                                 if (newcon != -1) {
     495                                if (newcon != -1)
    488496                                        change_console(&consoles[newcon]);
    489                                 }
    490497                        }
    491498                        retval = 0;
     
    515522        }
    516523       
    517         async_serialize_start();
     524        async_obsolete_serialize_start();
    518525       
    519526        size_t off = 0;
     
    523530        }
    524531       
    525         async_serialize_end();
     532        async_obsolete_serialize_end();
    526533       
    527534        gcons_notify_char(cons->index);
     
    549556       
    550557        size_t pos = 0;
    551         console_event_t ev;
     558        kbd_event_t ev;
    552559        fibril_mutex_lock(&input_mutex);
    553560       
     
    574581static void cons_get_event(console_t *cons, ipc_callid_t rid, ipc_call_t *request)
    575582{
    576         console_event_t ev;
     583        kbd_event_t ev;
    577584       
    578585        fibril_mutex_lock(&input_mutex);
     
    618625        int rc;
    619626       
    620         async_serialize_start();
     627        async_obsolete_serialize_start();
    621628        if (cons->refcount == 0)
    622629                gcons_notify_connect(cons->index);
     
    628635       
    629636        while (true) {
    630                 async_serialize_end();
     637                async_obsolete_serialize_end();
    631638                callid = async_get_call(&call);
    632                 async_serialize_start();
     639                async_obsolete_serialize_start();
    633640               
    634641                arg1 = 0;
     
    636643                arg3 = 0;
    637644               
    638                 switch (IPC_GET_IMETHOD(call)) {
    639                 case IPC_M_PHONE_HUNGUP:
     645                if (!IPC_GET_IMETHOD(call)) {
    640646                        cons->refcount--;
    641647                        if (cons->refcount == 0)
    642648                                gcons_notify_disconnect(cons->index);
    643649                        return;
     650                }
     651               
     652                switch (IPC_GET_IMETHOD(call)) {
    644653                case VFS_OUT_READ:
    645                         async_serialize_end();
     654                        async_obsolete_serialize_end();
    646655                        cons_read(cons, callid, &call);
    647                         async_serialize_start();
     656                        async_obsolete_serialize_start();
    648657                        continue;
    649658                case VFS_OUT_WRITE:
    650                         async_serialize_end();
     659                        async_obsolete_serialize_end();
    651660                        cons_write(cons, callid, &call);
    652                         async_serialize_start();
     661                        async_obsolete_serialize_start();
    653662                        continue;
    654663                case VFS_OUT_SYNC:
    655664                        fb_pending_flush();
    656665                        if (cons == active_console) {
    657                                 async_req_0_0(fb_info.phone, FB_FLUSH);
     666                                async_obsolete_req_0_0(fb_info.phone, FB_FLUSH);
    658667                                curs_goto(cons->scr.position_x, cons->scr.position_y);
    659668                        }
     
    662671                        /* Send message to fb */
    663672                        if (cons == active_console)
    664                                 async_msg_0(fb_info.phone, FB_CLEAR);
     673                                async_obsolete_msg_0(fb_info.phone, FB_CLEAR);
    665674                       
    666675                        screenbuffer_clear(&cons->scr);
     
    721730                        break;
    722731                case CONSOLE_GET_EVENT:
    723                         async_serialize_end();
     732                        async_obsolete_serialize_end();
    724733                        cons_get_event(cons, callid, &call);
    725                         async_serialize_start();
     734                        async_obsolete_serialize_start();
    726735                        continue;
    727736                case CONSOLE_KCON_ENABLE:
     
    739748
    740749static int async_connect_to_me_hack(int phone, sysarg_t arg1, sysarg_t arg2,
    741 sysarg_t arg3, async_client_conn_t client_receiver, ipc_callid_t *hash)
     750    sysarg_t arg3, async_client_conn_t client_receiver, ipc_callid_t *hash)
    742751{
    743752        sysarg_t task_hash;
    744753        sysarg_t phone_hash;
    745         int rc = async_req_3_5(phone, IPC_M_CONNECT_TO_ME, arg1, arg2, arg3,
     754        int rc = async_obsolete_req_3_5(phone, IPC_M_CONNECT_TO_ME, arg1, arg2, arg3,
    746755            NULL, NULL, NULL, &task_hash, &phone_hash);
    747756        if (rc != EOK)
    748757                return rc;
    749 
     758       
    750759        if (client_receiver != NULL)
    751760                async_new_connection(task_hash, phone_hash, phone_hash, NULL,
    752761                    client_receiver);
    753 
    754         if (hash != NULL) {
     762       
     763        if (hash != NULL)
    755764                *hash = phone_hash;
    756         }
    757 
     765       
    758766        return EOK;
    759767}
    760768
    761769static int connect_keyboard_or_mouse(const char *devname,
    762     async_client_conn_t handler, const char *path)
    763 {
    764         int fd = open(path, O_RDONLY);
    765         if (fd < 0) {
    766                 return fd;
    767         }
    768        
    769         int phone = fd_phone(fd);
    770         close(fd);
    771         if (phone < 0) {
    772                 printf(NAME ": Failed to connect to input device\n");
    773                 return phone;
    774         }
    775        
     770    async_client_conn_t handler, const char *dev)
     771{
     772        int phone;
     773        devmap_handle_t handle;
     774       
     775        int rc = devmap_device_get_handle(dev, &handle, 0);
     776        if (rc == EOK) {
     777                phone = devmap_obsolete_device_connect(handle, 0);
     778                if (phone < 0) {
     779                        printf("%s: Failed to connect to input device\n", NAME);
     780                        return phone;
     781                }
     782        } else
     783                return rc;
     784       
     785        /* NB: The callback connection is slotted for removal */
    776786        ipc_callid_t hash;
    777         int rc = async_connect_to_me_hack(phone, SERVICE_CONSOLE, 0, phone,
     787        rc = async_connect_to_me_hack(phone, SERVICE_CONSOLE, 0, phone,
    778788            handler, &hash);
    779789        if (rc != EOK) {
    780                 async_hangup(phone);
    781                 printf(NAME ": " \
    782                     "Failed to create callback from input device: %s.\n",
    783                     str_error(rc));
     790                async_obsolete_hangup(phone);
     791                printf("%s: Failed to create callback from input device (%s).\n",
     792                    NAME, str_error(rc));
    784793                return rc;
    785794        }
    786795       
    787796        driver_phones[phone] = hash;
    788 
    789         printf(NAME ": found %s \"%s\" (%" PRIxn ").\n", devname, path, hash);
    790 
     797        printf("%s: found %s \"%s\" (%" PRIxn ").\n", NAME, devname, dev, hash);
    791798        return phone;
    792799}
    793800
    794 static int connect_keyboard(const char *path)
    795 {
    796         return connect_keyboard_or_mouse("keyboard", keyboard_events, path);
    797 }
    798 
    799 static int connect_mouse(const char *path)
    800 {
    801         return connect_keyboard_or_mouse("mouse", mouse_events, path);
     801static int connect_keyboard(const char *dev)
     802{
     803        return connect_keyboard_or_mouse("keyboard", keyboard_events, dev);
     804}
     805
     806static int connect_mouse(const char *dev)
     807{
     808        return connect_keyboard_or_mouse("mouse", mouse_events, dev);
    802809}
    803810
     
    810817 *
    811818 * @param arg Class name.
     819 *
    812820 * @return This function should never exit.
     821 *
    813822 */
    814823static int check_new_device_fibril(void *arg)
    815824{
    816         struct hid_class_info *dev_info = arg;
    817 
     825        struct hid_class_info *dev_info = (struct hid_class_info *) arg;
     826       
    818827        size_t index = 1;
    819 
     828       
    820829        while (true) {
    821830                async_usleep(HOTPLUG_WATCH_INTERVAL);
    822                 char *path;
    823                 int rc = asprintf(&path, "/dev/class/%s\\%zu",
     831               
     832                char *dev;
     833                int rc = asprintf(&dev, "class/%s\\%zu",
    824834                    dev_info->classname, index);
    825                 if (rc < 0) {
     835                if (rc < 0)
    826836                        continue;
    827                 }
    828                 rc = 0;
    829                 rc = dev_info->connection_func(path);
     837               
     838                rc = dev_info->connection_func(dev);
    830839                if (rc > 0) {
    831840                        /* We do not allow unplug. */
    832841                        index++;
    833842                }
    834 
    835                 free(path);
    836         }
    837 
     843               
     844                free(dev);
     845        }
     846       
    838847        return EOK;
    839848}
    840 
    841849
    842850/** Start a fibril monitoring hot-plugged keyboards.
     
    847855        struct hid_class_info *dev_info = malloc(sizeof(struct hid_class_info));
    848856        if (dev_info == NULL) {
    849                 printf(NAME ": " \
    850                     "out of memory, will not start hot-plug-watch fibril.\n");
     857                printf("%s: Out of memory, no hot-plug support.\n", NAME);
    851858                return;
    852859        }
    853         int rc;
    854 
    855         rc = asprintf(&dev_info->classname, "%s", classname);
     860       
     861        int rc = asprintf(&dev_info->classname, "%s", classname);
    856862        if (rc < 0) {
    857                 printf(NAME ": failed to format classname: %s.\n",
     863                printf("%s: Failed to format classname: %s.\n", NAME,
    858864                    str_error(rc));
    859865                return;
    860866        }
     867       
    861868        dev_info->connection_func = connection_func;
    862 
    863         fid_t fid = fibril_create(check_new_device_fibril, (void *)dev_info);
     869       
     870        fid_t fid = fibril_create(check_new_device_fibril, (void *) dev_info);
    864871        if (!fid) {
    865                 printf(NAME
    866                     ": failed to create hot-plug-watch fibril for %s.\n",
     872                printf("%s: Failed to create hot-plug fibril for %s.\n", NAME,
    867873                    classname);
    868874                return;
    869875        }
     876       
    870877        fibril_add_ready(fid);
    871878}
    872879
    873 static bool console_init(char *input)
     880static bool console_srv_init(char *kdev)
    874881{
    875882        /* Connect to input device */
    876         kbd_phone = connect_keyboard(input);
    877         if (kbd_phone < 0) {
     883        kbd_phone = connect_keyboard(kdev);
     884        if (kbd_phone < 0)
    878885                return false;
    879         }
    880 
    881         mouse_phone = connect_mouse("/dev/hid_in/mouse");
     886       
     887        mouse_phone = connect_mouse("hid_in/mouse");
    882888        if (mouse_phone < 0) {
    883                 printf(NAME ": Failed to connect to mouse device: %s.\n",
     889                printf("%s: Failed to connect to mouse device %s\n", NAME,
    884890                    str_error(mouse_phone));
    885891        }
    886892       
    887893        /* Connect to framebuffer driver */
    888         fb_info.phone = service_connect_blocking(SERVICE_VIDEO, 0, 0);
     894        fb_info.phone = service_obsolete_connect_blocking(SERVICE_VIDEO, 0, 0);
    889895        if (fb_info.phone < 0) {
    890                 printf(NAME ": Failed to connect to video service\n");
    891                 return -1;
     896                printf("%s: Failed to connect to video service\n", NAME);
     897                return false;
    892898        }
    893899       
     
    895901        int rc = devmap_driver_register(NAME, client_connection);
    896902        if (rc < 0) {
    897                 printf(NAME ": Unable to register driver (%d)\n", rc);
     903                printf("%s: Unable to register driver (%d)\n", NAME, rc);
    898904                return false;
    899905        }
     
    903909       
    904910        /* Synchronize, the gcons could put something in queue */
    905         async_req_0_0(fb_info.phone, FB_FLUSH);
    906         async_req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.cols, &fb_info.rows);
    907         async_req_0_1(fb_info.phone, FB_GET_COLOR_CAP, &fb_info.color_cap);
     911        async_obsolete_req_0_0(fb_info.phone, FB_FLUSH);
     912        async_obsolete_req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.cols, &fb_info.rows);
     913        async_obsolete_req_0_1(fb_info.phone, FB_GET_COLOR_CAP, &fb_info.color_cap);
    908914       
    909915        /* Set up shared memory buffer. */
     
    916922       
    917923        if (interbuffer) {
    918                 if (async_share_out_start(fb_info.phone, interbuffer,
     924                if (async_obsolete_share_out_start(fb_info.phone, interbuffer,
    919925                    AS_AREA_READ) != EOK) {
    920926                        as_area_destroy(interbuffer);
     
    931937                        if (screenbuffer_init(&consoles[i].scr,
    932938                            fb_info.cols, fb_info.rows) == NULL) {
    933                                 printf(NAME ": Unable to allocate screen buffer %zu\n", i);
     939                                printf("%s: Unable to allocate screen buffer %zu\n", NAME, i);
    934940                                return false;
    935941                        }
     
    943949                       
    944950                        if (devmap_device_register(vc, &consoles[i].devmap_handle) != EOK) {
    945                                 printf(NAME ": Unable to register device %s\n", vc);
     951                                printf("%s: Unable to register device %s\n", NAME, vc);
    946952                                return false;
    947953                        }
     
    953959       
    954960        /* Initialize the screen */
    955         async_serialize_start();
     961        async_obsolete_serialize_start();
    956962        gcons_redraw_console();
    957963        set_style(STYLE_NORMAL);
     
    959965        curs_goto(0, 0);
    960966        curs_visibility(active_console->scr.is_cursor_visible);
    961         async_serialize_end();
     967        async_obsolete_serialize_end();
    962968       
    963969        /* Receive kernel notifications */
    964970        async_set_interrupt_received(interrupt_received);
    965971        if (event_subscribe(EVENT_KCONSOLE, 0) != EOK)
    966                 printf(NAME ": Error registering kconsole notifications\n");
     972                printf("%s: Error registering kconsole notifications\n", NAME);
    967973       
    968974        /* Start fibril for checking on hot-plugged keyboards. */
    969975        check_new_devices_in_background(connect_keyboard, "keyboard");
    970976        check_new_devices_in_background(connect_mouse, "mouse");
    971 
     977       
    972978        return true;
    973979}
     
    987993        printf(NAME ": HelenOS Console service\n");
    988994       
    989         if (!console_init(argv[1]))
     995        if (!console_srv_init(argv[1]))
    990996                return -1;
    991 
     997       
    992998        printf(NAME ": Accepting connections\n");
    993999        async_manager();
  • uspace/srv/hid/console/gcons.c

    r764d71e r79ae36dd  
    3535#include <ipc/fb.h>
    3636#include <async.h>
     37#include <async_obsolete.h>
    3738#include <stdio.h>
    3839#include <sys/mman.h>
     
    115116static void vp_switch(int vp)
    116117{
    117         async_msg_1(fbphone, FB_VIEWPORT_SWITCH, vp);
     118        async_obsolete_msg_1(fbphone, FB_VIEWPORT_SWITCH, vp);
    118119}
    119120
     
    121122static int vp_create(sysarg_t x, sysarg_t y, sysarg_t width, sysarg_t height)
    122123{
    123         return async_req_2_0(fbphone, FB_VIEWPORT_CREATE, (x << 16) | y,
     124        return async_obsolete_req_2_0(fbphone, FB_VIEWPORT_CREATE, (x << 16) | y,
    124125            (width << 16) | height);
    125126}
     
    127128static void clear(void)
    128129{
    129         async_msg_0(fbphone, FB_CLEAR);
     130        async_obsolete_msg_0(fbphone, FB_CLEAR);
    130131}
    131132
    132133static void set_rgb_color(uint32_t fgcolor, uint32_t bgcolor)
    133134{
    134         async_msg_2(fbphone, FB_SET_RGB_COLOR, fgcolor, bgcolor);
     135        async_obsolete_msg_2(fbphone, FB_SET_RGB_COLOR, fgcolor, bgcolor);
    135136}
    136137
     
    138139static void tran_putch(wchar_t ch, sysarg_t col, sysarg_t row)
    139140{
    140         async_msg_3(fbphone, FB_PUTCHAR, ch, col, row);
     141        async_obsolete_msg_3(fbphone, FB_PUTCHAR, ch, col, row);
    141142}
    142143
     
    149150       
    150151        if (ic_pixmaps[state] != -1)
    151                 async_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[index],
     152                async_obsolete_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[index],
    152153                    ic_pixmaps[state]);
    153154       
     
    177178               
    178179                if (animation != -1)
    179                         async_msg_1(fbphone, FB_ANIM_START, animation);
     180                        async_obsolete_msg_1(fbphone, FB_ANIM_START, animation);
    180181        } else {
    181182                if (console_state[active_console] == CONS_DISCONNECTED_SEL)
     
    258259{
    259260        if (animation != -1)
    260                 async_msg_1(fbphone, FB_ANIM_STOP, animation);
     261                async_obsolete_msg_1(fbphone, FB_ANIM_STOP, animation);
    261262       
    262263        active_console = KERNEL_CONSOLE;
     
    294295       
    295296        if (active_console != KERNEL_CONSOLE)
    296                 async_msg_2(fbphone, FB_POINTER_MOVE, mouse_x, mouse_y);
     297                async_obsolete_msg_2(fbphone, FB_POINTER_MOVE, mouse_x, mouse_y);
    297298}
    298299
     
    374375       
    375376        /* Send area */
    376         int rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (sysarg_t) shm);
     377        int rc = async_obsolete_req_1_0(fbphone, FB_PREPARE_SHM, (sysarg_t) shm);
    377378        if (rc)
    378379                goto exit;
    379380       
    380         rc = async_share_out_start(fbphone, shm, PROTO_READ);
     381        rc = async_obsolete_share_out_start(fbphone, shm, PROTO_READ);
    381382        if (rc)
    382383                goto drop;
    383384       
    384385        /* Draw logo */
    385         async_msg_2(fbphone, FB_DRAW_PPM, x, y);
     386        async_obsolete_msg_2(fbphone, FB_DRAW_PPM, x, y);
    386387       
    387388drop:
    388389        /* Drop area */
    389         async_msg_0(fbphone, FB_DROP_SHM);
     390        async_obsolete_msg_0(fbphone, FB_DROP_SHM);
    390391       
    391392exit:
     
    436437       
    437438        /* Send area */
    438         int rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (sysarg_t) shm);
     439        int rc = async_obsolete_req_1_0(fbphone, FB_PREPARE_SHM, (sysarg_t) shm);
    439440        if (rc)
    440441                goto exit;
    441442       
    442         rc = async_share_out_start(fbphone, shm, PROTO_READ);
     443        rc = async_obsolete_share_out_start(fbphone, shm, PROTO_READ);
    443444        if (rc)
    444445                goto drop;
    445446       
    446447        /* Obtain pixmap */
    447         rc = async_req_0_0(fbphone, FB_SHM2PIXMAP);
     448        rc = async_obsolete_req_0_0(fbphone, FB_SHM2PIXMAP);
    448449        if (rc < 0)
    449450                goto drop;
     
    453454drop:
    454455        /* Drop area */
    455         async_msg_0(fbphone, FB_DROP_SHM);
     456        async_obsolete_msg_0(fbphone, FB_DROP_SHM);
    456457       
    457458exit:
     
    464465static void make_anim(void)
    465466{
    466         int an = async_req_1_0(fbphone, FB_ANIM_CREATE,
     467        int an = async_obsolete_req_1_0(fbphone, FB_ANIM_CREATE,
    467468            cstatus_vp[KERNEL_CONSOLE]);
    468469        if (an < 0)
     
    471472        int pm = make_pixmap(_binary_gfx_anim_1_ppm_start,
    472473            (size_t) &_binary_gfx_anim_1_ppm_size);
    473         async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
     474        async_obsolete_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    474475       
    475476        pm = make_pixmap(_binary_gfx_anim_2_ppm_start,
    476477            (size_t) &_binary_gfx_anim_2_ppm_size);
    477         async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
     478        async_obsolete_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    478479       
    479480        pm = make_pixmap(_binary_gfx_anim_3_ppm_start,
    480481            (size_t) &_binary_gfx_anim_3_ppm_size);
    481         async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
     482        async_obsolete_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    482483       
    483484        pm = make_pixmap(_binary_gfx_anim_4_ppm_start,
    484485            (size_t) &_binary_gfx_anim_4_ppm_size);
    485         async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    486        
    487         async_msg_1(fbphone, FB_ANIM_START, an);
     486        async_obsolete_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
     487       
     488        async_obsolete_msg_1(fbphone, FB_ANIM_START, an);
    488489       
    489490        animation = an;
     
    495496        fbphone = phone;
    496497       
    497         int rc = async_req_0_2(phone, FB_GET_RESOLUTION, &xres, &yres);
     498        int rc = async_obsolete_req_0_2(phone, FB_GET_RESOLUTION, &xres, &yres);
    498499        if (rc)
    499500                return;
  • uspace/srv/hid/console/keybuffer.c

    r764d71e r79ae36dd  
    9090 *
    9191 */
    92 void keybuffer_push(keybuffer_t *keybuffer, const console_event_t *ev)
     92void keybuffer_push(keybuffer_t *keybuffer, const kbd_event_t *ev)
    9393{
    9494        futex_down(&keybuffer_futex);
     
    110110 *
    111111 */
    112 bool keybuffer_pop(keybuffer_t *keybuffer, console_event_t *edst)
     112bool keybuffer_pop(keybuffer_t *keybuffer, kbd_event_t *edst)
    113113{
    114114        futex_down(&keybuffer_futex);
  • uspace/srv/hid/console/keybuffer.h

    r764d71e r79ae36dd  
    4646
    4747typedef struct {
    48         console_event_t fifo[KEYBUFFER_SIZE];
     48        kbd_event_t fifo[KEYBUFFER_SIZE];
    4949        size_t head;
    5050        size_t tail;
     
    5656extern size_t keybuffer_available(keybuffer_t *);
    5757extern bool keybuffer_empty(keybuffer_t *);
    58 extern void keybuffer_push(keybuffer_t *, const console_event_t *);
    59 extern bool keybuffer_pop(keybuffer_t *, console_event_t *);
     58extern void keybuffer_push(keybuffer_t *, const kbd_event_t *);
     59extern bool keybuffer_pop(keybuffer_t *, kbd_event_t *);
    6060
    6161#endif
  • uspace/srv/hid/fb/ega.c

    r764d71e r79ae36dd  
    5252#include <io/screenbuffer.h>
    5353#include <sys/types.h>
    54 
    5554#include "ega.h"
    5655#include "main.h"
     56
     57// FIXME: remove this header
     58#include <kernel/ipc/ipc_methods.h>
    5759
    5860#define MAX_SAVED_SCREENS  256
     
    291293                int retval;
    292294               
    293                 switch (IPC_GET_IMETHOD(call)) {
    294                 case IPC_M_PHONE_HUNGUP:
     295                if (!IPC_GET_IMETHOD(call)) {
    295296                        client_connected = 0;
    296297                        async_answer_0(callid, EOK);
     
    298299                        /* Exit thread */
    299300                        return;
     301                }
     302               
     303                switch (IPC_GET_IMETHOD(call)) {
    300304                case IPC_M_SHARE_OUT:
    301305                        /* We accept one area for data interchange */
  • uspace/srv/hid/fb/fb.c

    r764d71e r79ae36dd  
    5959#include <byteorder.h>
    6060#include <io/screenbuffer.h>
    61 
    6261#include "font-8x16.h"
    6362#include "fb.h"
    6463#include "main.h"
    6564#include "ppm.h"
    66 
    6765#include "pointer.xbm"
    6866#include "pointer_mask.xbm"
     67
     68// FIXME: remove this header
     69#include <kernel/ipc/ipc_methods.h>
    6970
    7071#define DEFAULT_BGCOLOR  0xf0f0f0
     
    16201621                        continue;
    16211622               
    1622                 switch (IPC_GET_IMETHOD(call)) {
    1623                 case IPC_M_PHONE_HUNGUP:
     1623                if (!IPC_GET_IMETHOD(call)) {
    16241624                        client_connected = false;
    16251625                       
     
    16301630                        /* Exit thread */
    16311631                        return;
     1632                }
    16321633               
     1634                switch (IPC_GET_IMETHOD(call)) {
    16331635                case FB_PUTCHAR:
    16341636                        ch = IPC_GET_ARG1(call);
  • uspace/srv/hid/fb/main.c

    r764d71e r79ae36dd  
    2828
    2929#include <ipc/services.h>
    30 #include <ipc/ns.h>
     30#include <ns.h>
    3131#include <sysinfo.h>
    3232#include <async.h>
  • uspace/srv/hid/fb/serial_console.c

    r764d71e r79ae36dd  
    5252#include "serial_console.h"
    5353
     54// FIXME: remove this header
     55#include <kernel/ipc/ipc_methods.h>
     56
    5457#define MAX_CONTROL 20
    5558
     
    344347                int retval;
    345348               
    346                 switch (IPC_GET_IMETHOD(call)) {
    347                 case IPC_M_PHONE_HUNGUP:
     349                if (!IPC_GET_IMETHOD(call)) {
    348350                        client_connected = 0;
    349351                        async_answer_0(callid, EOK);
     
    351353                        /* Exit thread */
    352354                        return;
     355                }
     356               
     357                switch (IPC_GET_IMETHOD(call)) {
    353358                case IPC_M_SHARE_OUT:
    354359                        /* We accept one area for data interchange */
  • uspace/srv/hid/kbd/ctl/apple.c

    r764d71e r79ae36dd  
    5252void kbd_ctl_parse_scancode(int scancode)
    5353{
    54         console_ev_type_t type;
     54        kbd_event_type_t type;
    5555        unsigned int key;
    5656
  • uspace/srv/hid/kbd/ctl/pc.c

    r764d71e r79ae36dd  
    205205void kbd_ctl_parse_scancode(int scancode)
    206206{
    207         console_ev_type_t type;
     207        kbd_event_type_t type;
    208208        unsigned int key;
    209209        int *map;
  • uspace/srv/hid/kbd/ctl/sun.c

    r764d71e r79ae36dd  
    5353void kbd_ctl_parse_scancode(int scancode)
    5454{
    55         console_ev_type_t type;
     55        kbd_event_type_t type;
    5656        unsigned int key;
    5757
  • uspace/srv/hid/kbd/generic/kbd.c

    r764d71e r79ae36dd  
    4343#include <stdlib.h>
    4444#include <stdio.h>
    45 #include <ipc/ns.h>
     45#include <ns.h>
     46#include <ns_obsolete.h>
    4647#include <async.h>
     48#include <async_obsolete.h>
    4749#include <errno.h>
    4850#include <adt/fifo.h>
     
    5052#include <io/keycode.h>
    5153#include <devmap.h>
    52 
    5354#include <kbd.h>
    5455#include <kbd_port.h>
    5556#include <kbd_ctl.h>
    5657#include <layout.h>
     58
     59// FIXME: remove this header
     60#include <kernel/ipc/ipc_methods.h>
    5761
    5862#define NAME       "kbd"
     
    8892void kbd_push_ev(int type, unsigned int key)
    8993{
    90         console_event_t ev;
     94        kbd_event_t ev;
    9195        unsigned mod_mask;
    9296
     
    163167        ev.c = layout[active_layout]->parse_ev(&ev);
    164168
    165         async_msg_4(client_phone, KBD_EVENT, ev.type, ev.key, ev.mods, ev.c);
     169        async_obsolete_msg_4(client_phone, KBD_EVENT, ev.type, ev.key, ev.mods, ev.c);
    166170}
    167171
     
    174178        async_answer_0(iid, EOK);
    175179
    176         while (1) {
     180        while (true) {
    177181                callid = async_get_call(&call);
    178                 switch (IPC_GET_IMETHOD(call)) {
    179                 case IPC_M_PHONE_HUNGUP:
     182               
     183                if (!IPC_GET_IMETHOD(call)) {
    180184                        if (client_phone != -1) {
    181                                 async_hangup(client_phone);
     185                                async_obsolete_hangup(client_phone);
    182186                                client_phone = -1;
    183187                        }
     
    185189                        async_answer_0(callid, EOK);
    186190                        return;
     191                }
     192               
     193                switch (IPC_GET_IMETHOD(call)) {
    187194                case IPC_M_CONNECT_TO_ME:
    188195                        if (client_phone != -1) {
     
    222229        if (irc_service) {
    223230                while (irc_phone < 0)
    224                         irc_phone = service_connect_blocking(SERVICE_IRC, 0, 0);
     231                        irc_phone = service_obsolete_connect_blocking(SERVICE_IRC, 0, 0);
    225232        }
    226233       
  • uspace/srv/hid/kbd/include/layout.h

    r764d71e r79ae36dd  
    4343typedef struct {
    4444        void (*reset)(void);
    45         wchar_t (*parse_ev)(console_event_t *);
     45        wchar_t (*parse_ev)(kbd_event_t *);
    4646} layout_op_t;
    4747
  • uspace/srv/hid/kbd/layout/cz.c

    r764d71e r79ae36dd  
    3939
    4040static void layout_reset(void);
    41 static wchar_t layout_parse_ev(console_event_t *ev);
     41static wchar_t layout_parse_ev(kbd_event_t *ev);
    4242
    4343enum m_state {
     
    273273}
    274274
    275 static wchar_t parse_ms_hacek(console_event_t *ev)
     275static wchar_t parse_ms_hacek(kbd_event_t *ev)
    276276{
    277277        wchar_t c;
     
    291291}
    292292
    293 static wchar_t parse_ms_carka(console_event_t *ev)
     293static wchar_t parse_ms_carka(kbd_event_t *ev)
    294294{
    295295        wchar_t c;
     
    309309}
    310310
    311 static wchar_t parse_ms_start(console_event_t *ev)
     311static wchar_t parse_ms_start(kbd_event_t *ev)
    312312{
    313313        wchar_t c;
     
    384384}
    385385
    386 static wchar_t layout_parse_ev(console_event_t *ev)
     386static wchar_t layout_parse_ev(kbd_event_t *ev)
    387387{
    388388        if (ev->type != KEY_PRESS)
  • uspace/srv/hid/kbd/layout/us_dvorak.c

    r764d71e r79ae36dd  
    3838
    3939static void layout_reset(void);
    40 static wchar_t layout_parse_ev(console_event_t *ev);
     40static wchar_t layout_parse_ev(kbd_event_t *ev);
    4141
    4242layout_op_t us_dvorak_op = {
     
    210210}
    211211
    212 static wchar_t layout_parse_ev(console_event_t *ev)
     212static wchar_t layout_parse_ev(kbd_event_t *ev)
    213213{
    214214        wchar_t c;
  • uspace/srv/hid/kbd/layout/us_qwerty.c

    r764d71e r79ae36dd  
    3838
    3939static void layout_reset(void);
    40 static wchar_t layout_parse_ev(console_event_t *ev);
     40static wchar_t layout_parse_ev(kbd_event_t *ev);
    4141
    4242layout_op_t us_qwerty_op = {
     
    204204}
    205205
    206 static wchar_t layout_parse_ev(console_event_t *ev)
     206static wchar_t layout_parse_ev(kbd_event_t *ev)
    207207{
    208208        wchar_t c;
  • uspace/srv/hid/kbd/port/adb.c

    r764d71e r79ae36dd  
    3030 * @ingroup kbd
    3131 * @{
    32  */ 
     32 */
    3333/** @file
    3434 * @brief ADB keyboard port driver.
     
    3737#include <ipc/adb.h>
    3838#include <async.h>
     39#include <async_obsolete.h>
    3940#include <kbd_port.h>
    4041#include <kbd.h>
     
    4243#include <fcntl.h>
    4344#include <errno.h>
     45#include <devmap.h>
     46#include <devmap_obsolete.h>
    4447
    4548static void kbd_port_events(ipc_callid_t iid, ipc_call_t *icall);
     
    5255int kbd_port_init(void)
    5356{
    54         const char *input = "/dev/adb/kbd";
    55         int input_fd;
    56 
    57         printf(NAME ": open %s\n", input);
    58 
    59         input_fd = open(input, O_RDONLY);
    60         if (input_fd < 0) {
    61                 printf(NAME ": Failed opening %s (%d)\n", input, input_fd);
    62                 return false;
     57        const char *dev = "adb/kbd";
     58        devmap_handle_t handle;
     59       
     60        int rc = devmap_device_get_handle(dev, &handle, 0);
     61        if (rc == EOK) {
     62                dev_phone = devmap_obsolete_device_connect(handle, 0);
     63                if (dev_phone < 0) {
     64                        printf("%s: Failed to connect to device\n", NAME);
     65                        return dev_phone;
     66                }
     67        } else
     68                return rc;
     69       
     70        /* NB: The callback connection is slotted for removal */
     71        rc = async_obsolete_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events);
     72        if (rc != EOK) {
     73                printf(NAME ": Failed to create callback from device\n");
     74                return rc;
    6375        }
    64 
    65         dev_phone = fd_phone(input_fd);
    66         if (dev_phone < 0) {
    67                 printf(NAME ": Failed to connect to device\n");
    68                 return false;
    69         }
    70 
    71         /* NB: The callback connection is slotted for removal */
    72         if (async_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events) != 0) {
    73                 printf(NAME ": Failed to create callback from device\n");
    74                 return false;
    75         }
    76 
    77         return 0;
     76       
     77        return EOK;
    7878}
    7979
     
    100100
    101101                int retval;
    102 
    103                 switch (IPC_GET_IMETHOD(call)) {
    104                 case IPC_M_PHONE_HUNGUP:
     102               
     103                if (!IPC_GET_IMETHOD(call)) {
    105104                        /* TODO: Handle hangup */
    106105                        return;
     106                }
     107               
     108                switch (IPC_GET_IMETHOD(call)) {
    107109                case ADB_REG_NOTIF:
    108110                        adb_kbd_reg0_data(IPC_GET_ARG1(call));
  • uspace/srv/hid/kbd/port/chardev.c

    r764d71e r79ae36dd  
    3030 * @ingroup kbd
    3131 * @{
    32  */ 
     32 */
    3333/** @file
    3434 * @brief Chardev keyboard port driver.
     
    3737#include <ipc/char.h>
    3838#include <async.h>
     39#include <async_obsolete.h>
    3940#include <kbd_port.h>
    4041#include <kbd.h>
    41 #include <vfs/vfs.h>
    42 #include <sys/stat.h>
    43 #include <fcntl.h>
     42#include <devmap.h>
     43#include <devmap_obsolete.h>
    4444#include <errno.h>
     45#include <stdio.h>
     46
     47#define NAME  "kbd/chardev"
    4548
    4649static void kbd_port_events(ipc_callid_t iid, ipc_call_t *icall);
     
    4851static int dev_phone;
    4952
    50 #define NAME "kbd"
    51 
    5253/** List of devices to try connecting to. */
    5354static const char *in_devs[] = {
    54         "/dev/char/ps2a",
    55         "/dev/char/s3c24ser"
     55        "char/ps2a",
     56        "char/s3c24ser"
    5657};
    5758
    58 static const int num_devs = sizeof(in_devs) / sizeof(in_devs[0]);
     59static const unsigned int num_devs = sizeof(in_devs) / sizeof(in_devs[0]);
    5960
    6061int kbd_port_init(void)
    6162{
    62         int input_fd;
    63         int i;
    64 
    65         input_fd = -1;
     63        devmap_handle_t handle;
     64        unsigned int i;
     65        int rc;
     66       
    6667        for (i = 0; i < num_devs; i++) {
    67                 struct stat s;
    68 
    69                 if (stat(in_devs[i], &s) == EOK)
     68                rc = devmap_device_get_handle(in_devs[i], &handle, 0);
     69                if (rc == EOK)
    7070                        break;
    7171        }
    72 
     72       
    7373        if (i >= num_devs) {
    74                 printf(NAME ": Could not find any suitable input device.\n");
     74                printf("%s: Could not find any suitable input device\n", NAME);
    7575                return -1;
    7676        }
    77 
    78         input_fd = open(in_devs[i], O_RDONLY);
    79         if (input_fd < 0) {
    80                 printf(NAME ": failed opening device %s (%d).\n", in_devs[i],
    81                     input_fd);
    82                 return -1;
     77       
     78        dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING);
     79        if (dev_phone < 0) {
     80                printf("%s: Failed connecting to device\n", NAME);
     81                return ENOENT;
    8382        }
    84 
    85         dev_phone = fd_phone(input_fd);
    86         if (dev_phone < 0) {
    87                 printf(NAME ": Failed connecting to device\n");
    88                 return -1;
    89         }
    90 
     83       
    9184        /* NB: The callback connection is slotted for removal */
    92         if (async_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events) != 0) {
     85        if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events) != 0) {
    9386                printf(NAME ": Failed to create callback from device\n");
    9487                return -1;
     
    108101void kbd_port_write(uint8_t data)
    109102{
    110         async_msg_1(dev_phone, CHAR_WRITE_BYTE, data);
     103        async_obsolete_msg_1(dev_phone, CHAR_WRITE_BYTE, data);
    111104}
    112105
     
    118111                ipc_call_t call;
    119112                ipc_callid_t callid = async_get_call(&call);
     113               
     114                if (!IPC_GET_IMETHOD(call)) {
     115                        /* TODO: Handle hangup */
     116                        return;
     117                }
    120118
    121119                int retval;
    122120
    123121                switch (IPC_GET_IMETHOD(call)) {
    124                 case IPC_M_PHONE_HUNGUP:
    125                         /* TODO: Handle hangup */
    126                         return;
    127122                case CHAR_NOTIF_BYTE:
    128123                        kbd_push_scancode(IPC_GET_ARG1(call));
  • uspace/srv/hid/kbd/port/ns16550.c

    r764d71e r79ae36dd  
    3737#include <ipc/irc.h>
    3838#include <async.h>
     39#include <async_obsolete.h>
    3940#include <sysinfo.h>
    4041#include <kbd.h>
     
    121122       
    122123        if (irc_service)
    123                 async_msg_1(irc_phone, IRC_CLEAR_INTERRUPT,
     124                async_obsolete_msg_1(irc_phone, IRC_CLEAR_INTERRUPT,
    124125                    IPC_GET_IMETHOD(*call));
    125126}
  • uspace/srv/hid/kbd/port/z8530.c

    r764d71e r79ae36dd  
    3737#include <ipc/irc.h>
    3838#include <async.h>
     39#include <async_obsolete.h>
    3940#include <sysinfo.h>
    4041#include <kbd.h>
     
    109110       
    110111        if (irc_service)
    111                 async_msg_1(irc_phone, IRC_CLEAR_INTERRUPT,
     112                async_obsolete_msg_1(irc_phone, IRC_CLEAR_INTERRUPT,
    112113                    IPC_GET_IMETHOD(*call));
    113114}
  • uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c

    r764d71e r79ae36dd  
    4444#include <ipc/mouse.h>
    4545#include <async.h>
     46#include <async_obsolete.h>
    4647#include <unistd.h>
    4748#include <stdio.h>
     
    5051#include <errno.h>
    5152#include <inttypes.h>
    52 
    5353#include "s3c24xx_ts.h"
     54
     55// FIXME: remove this header
     56#include <kernel/ipc/ipc_methods.h>
    5457
    5558#define NAME "s3c24ser"
     
    280283        button = 1;
    281284        press = 0;
    282         async_msg_2(ts->client_phone, MEVENT_BUTTON, button, press);
     285        async_obsolete_msg_2(ts->client_phone, MEVENT_BUTTON, button, press);
    283286
    284287        s3c24xx_ts_wait_for_int_mode(ts, updn_down);
     
    321324
    322325        /* Send notifications to client. */
    323         async_msg_2(ts->client_phone, MEVENT_MOVE, dx, dy);
    324         async_msg_2(ts->client_phone, MEVENT_BUTTON, button, press);
     326        async_obsolete_msg_2(ts->client_phone, MEVENT_MOVE, dx, dy);
     327        async_obsolete_msg_2(ts->client_phone, MEVENT_BUTTON, button, press);
    325328
    326329        ts->last_x = x_pos;
     
    380383        while (1) {
    381384                callid = async_get_call(&call);
    382                 switch (IPC_GET_IMETHOD(call)) {
    383                 case IPC_M_PHONE_HUNGUP:
     385               
     386                if (!IPC_GET_IMETHOD(call)) {
    384387                        if (ts->client_phone != -1) {
    385                                 async_hangup(ts->client_phone);
     388                                async_obsolete_hangup(ts->client_phone);
    386389                                ts->client_phone = -1;
    387390                        }
     
    389392                        async_answer_0(callid, EOK);
    390393                        return;
     394                }
     395               
     396                switch (IPC_GET_IMETHOD(call)) {
    391397                case IPC_M_CONNECT_TO_ME:
    392398                        if (ts->client_phone != -1) {
Note: See TracChangeset for help on using the changeset viewer.