Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/console/console.c

    r1875a0c r854eddd6  
    5454#include <event.h>
    5555#include <devmap.h>
     56#include <devmap_obsolete.h>
    5657#include <fcntl.h>
    5758#include <vfs/vfs.h>
     
    6768#define NAMESPACE  "term"
    6869
    69 /** Session with the input server. */
    70 static async_sess_t *input_sess;
     70/** Phone to the input server. */
     71static int input_phone;
    7172
    7273/** Information about framebuffer */
     
    108109static FIBRIL_CONDVAR_INITIALIZE(input_cv);
    109110
    110 static FIBRIL_MUTEX_INITIALIZE(big_console_lock);
    111 
    112 static void console_serialize_start(void)
    113 {
    114         fibril_mutex_lock(&big_console_lock);
    115 }
    116 
    117 static void console_serialize_end(void)
    118 {
    119         fibril_mutex_unlock(&big_console_lock);
    120 }
    121 
    122111static void curs_visibility(bool visible)
    123112{
     
    152141static void input_yield(void)
    153142{
    154         async_exch_t *exch = async_exchange_begin(input_sess);
    155         if (exch == NULL) {
    156                 printf("%s: Failed starting exchange with input device.\n",
    157                     NAME);
    158                 return;
    159         }
    160        
    161         async_req_0_0(exch, INPUT_YIELD);
    162         async_exchange_end(exch);
     143        async_obsolete_req_0_0(input_phone, INPUT_YIELD);
    163144}
    164145
    165146static void input_reclaim(void)
    166147{
    167         async_exch_t *exch = async_exchange_begin(input_sess);
    168         if (exch == NULL) {
    169                 printf("%s: Failed starting exchange with input device.\n",
    170                     NAME);
    171                 return;
    172         }
    173        
    174         async_req_0_0(exch, INPUT_RECLAIM);
    175         async_exchange_end(exch);
     148        async_obsolete_req_0_0(input_phone, INPUT_RECLAIM);
    176149}
    177150
     
    350323       
    351324        if (cons == kernel_console) {
    352                 console_serialize_start();
     325                async_obsolete_serialize_start();
    353326                curs_hide_sync();
    354327                gcons_in_kernel();
    355328                screen_yield();
    356329                input_yield();
    357                 console_serialize_end();
     330                async_obsolete_serialize_end();
    358331               
    359332                if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE)) {
     
    365338       
    366339        if (cons != kernel_console) {
    367                 console_serialize_start();
     340                async_obsolete_serialize_start();
    368341               
    369342                if (active_console == kernel_console) {
     
    420393                curs_visibility(cons->scr.is_cursor_visible);
    421394               
    422                 console_serialize_end();
     395                async_obsolete_serialize_end();
    423396        }
    424397}
     
    437410                if (!IPC_GET_IMETHOD(call)) {
    438411                        /* TODO: Handle hangup */
    439                         async_hangup(input_sess);
     412                        async_obsolete_hangup(input_phone);
    440413                        return;
    441414                }
     
    482455                        retval = ENOENT;
    483456                }
    484 
    485457                async_answer_0(callid, retval);
    486458        }
     
    498470        }
    499471       
    500         console_serialize_start();
     472        async_obsolete_serialize_start();
    501473       
    502474        size_t off = 0;
     
    506478        }
    507479       
    508         console_serialize_end();
     480        async_obsolete_serialize_end();
    509481       
    510482        gcons_notify_char(cons->index);
     
    601573        int rc;
    602574       
    603         console_serialize_start();
     575        async_obsolete_serialize_start();
    604576        if (cons->refcount == 0)
    605577                gcons_notify_connect(cons->index);
     
    611583       
    612584        while (true) {
    613                 console_serialize_end();
     585                async_obsolete_serialize_end();
    614586                callid = async_get_call(&call);
    615                 console_serialize_start();
     587                async_obsolete_serialize_start();
    616588               
    617589                arg1 = 0;
     
    623595                        if (cons->refcount == 0)
    624596                                gcons_notify_disconnect(cons->index);
    625                         console_serialize_end();
    626597                        return;
    627598                }
     
    629600                switch (IPC_GET_IMETHOD(call)) {
    630601                case VFS_OUT_READ:
    631                         console_serialize_end();
     602                        async_obsolete_serialize_end();
    632603                        cons_read(cons, callid, &call);
    633                         console_serialize_start();
     604                        async_obsolete_serialize_start();
    634605                        continue;
    635606                case VFS_OUT_WRITE:
    636                         console_serialize_end();
     607                        async_obsolete_serialize_end();
    637608                        cons_write(cons, callid, &call);
    638                         console_serialize_start();
     609                        async_obsolete_serialize_start();
    639610                        continue;
    640611                case VFS_OUT_SYNC:
     
    707678                        break;
    708679                case CONSOLE_GET_EVENT:
    709                         console_serialize_end();
     680                        async_obsolete_serialize_end();
    710681                        cons_get_event(cons, callid, &call);
    711                         console_serialize_start();
     682                        async_obsolete_serialize_start();
    712683                        continue;
    713684                case CONSOLE_KCON_ENABLE:
     
    724695}
    725696
    726 static async_sess_t *connect_input(const char *dev_path)
    727 {
    728         async_sess_t *sess;
    729         async_exch_t *exch;
     697static int connect_input(const char *dev_path)
     698{
     699        int phone;
    730700        devmap_handle_t handle;
    731701       
    732702        int rc = devmap_device_get_handle(dev_path, &handle, 0);
    733703        if (rc == EOK) {
    734                 sess = devmap_device_connect(EXCHANGE_ATOMIC, handle, 0);
    735                 if (sess == NULL) {
    736                         printf("%s: Failed to connect to input server\n", NAME);
    737                         return NULL;
     704                phone = devmap_obsolete_device_connect(handle, 0);
     705                if (phone < 0) {
     706                        printf("%s: Failed to connect to input device\n", NAME);
     707                        return phone;
    738708                }
    739709        } else {
    740                 return NULL;
    741         }
    742        
    743         exch = async_exchange_begin(sess);
    744         if (exch == NULL) {
    745                 printf("%s: Failed to create callback from input server.\n", NAME);
    746                 return NULL;
     710                return rc;
    747711        }
    748712       
    749713        /* NB: The callback connection is slotted for removal */
    750         rc = async_connect_to_me(exch, 0, 0, 0, input_events, NULL);
    751 
    752         async_exchange_end(exch);
     714        rc = async_obsolete_connect_to_me(phone, SERVICE_CONSOLE, 0, 0,
     715            input_events, NULL);
    753716
    754717        if (rc != EOK) {
    755                 async_hangup(sess);
    756                 printf("%s: Failed to create callback from input server (%s).\n",
     718                async_obsolete_hangup(phone);
     719                printf("%s: Failed to create callback from input device (%s).\n",
    757720                    NAME, str_error(rc));
    758                 return NULL;
    759         }
    760        
    761         return sess;
     721                return rc;
     722        }
     723       
     724        return phone;
    762725}
    763726
     
    765728{
    766729        /* Connect to input server */
    767         input_sess = connect_input(input_dev);
    768         if (input_sess == NULL)
     730        input_phone = connect_input(input_dev);
     731        if (input_phone < 0)
    769732                return false;
    770733       
     
    837800       
    838801        /* Initialize the screen */
    839         console_serialize_start();
     802        async_obsolete_serialize_start();
    840803        gcons_redraw_console();
    841804        set_style(STYLE_NORMAL);
     
    843806        curs_goto(0, 0);
    844807        curs_visibility(active_console->scr.is_cursor_visible);
    845         console_serialize_end();
     808        async_obsolete_serialize_end();
    846809       
    847810        /* Receive kernel notifications */
Note: See TracChangeset for help on using the changeset viewer.