Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/input/proto/mousedev.c

    r3123d2a rcce8a83  
    5454        /** Link to generic mouse device */
    5555        mouse_dev_t *mouse_dev;
     56       
     57        /** Session to mouse device */
     58        async_sess_t *sess;
    5659} mousedev_t;
    5760
     
    6972static void mousedev_destroy(mousedev_t *mousedev)
    7073{
     74        if (mousedev->sess != NULL)
     75                async_hangup(mousedev->sess);
     76       
    7177        free(mousedev);
    7278}
     
    8389               
    8490                if (!IPC_GET_IMETHOD(call)) {
    85                         mousedev_destroy(mousedev);
     91                        /* XXX Handle hangup */
    8692                        return;
    8793                }
     
    9197                switch (IPC_GET_IMETHOD(call)) {
    9298                case MOUSEEV_MOVE_EVENT:
    93                         mouse_push_event_move(mousedev->mouse_dev,
    94                             IPC_GET_ARG1(call), IPC_GET_ARG2(call),
    95                             IPC_GET_ARG3(call));
     99                        mouse_push_event_move(mousedev->mouse_dev, IPC_GET_ARG1(call),
     100                            IPC_GET_ARG2(call));
    96101                        retval = EOK;
    97102                        break;
    98103                case MOUSEEV_BUTTON_EVENT:
    99                         mouse_push_event_button(mousedev->mouse_dev,
    100                             IPC_GET_ARG1(call), IPC_GET_ARG2(call));
     104                        mouse_push_event_button(mousedev->mouse_dev, IPC_GET_ARG1(call),
     105                            IPC_GET_ARG2(call));
    101106                        retval = EOK;
    102107                        break;
     
    117122                printf("%s: Failed starting session with '%s'\n", NAME,
    118123                    mdev->svc_name);
    119                 return ENOENT;
     124                return -1;
    120125        }
    121126       
     
    124129                printf("%s: Failed allocating device structure for '%s'.\n",
    125130                    NAME, mdev->svc_name);
    126                 async_hangup(sess);
    127                 return ENOMEM;
     131                return -1;
    128132        }
     133       
     134        mousedev->sess = sess;
    129135       
    130136        async_exch_t *exch = async_exchange_begin(sess);
     
    133139                    mdev->svc_name);
    134140                mousedev_destroy(mousedev);
    135                 async_hangup(sess);
    136                 return ENOENT;
     141                return -1;
    137142        }
    138143       
    139144        int rc = async_connect_to_me(exch, 0, 0, 0, mousedev_callback_conn, mousedev);
    140145        async_exchange_end(exch);
    141         async_hangup(sess);
    142146       
    143147        if (rc != EOK) {
     
    145149                    NAME, mdev->svc_name);
    146150                mousedev_destroy(mousedev);
    147                 return rc;
     151                return -1;
    148152        }
    149153       
    150         return EOK;
     154        return 0;
    151155}
    152156
Note: See TracChangeset for help on using the changeset viewer.