Changes in / [2df6f6fe:948911d] in mainline


Ignore:
Location:
uspace
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhid/kbd/kbddev.c

    r2df6f6fe r948911d  
    7171#include "../usbhid.h"
    7272
     73static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);
     74static ddf_dev_ops_t kbdops = { .default_handler = default_connection_handler };
    7375/*----------------------------------------------------------------------------*/
    7476
     
    187189                        break;
    188190                }
    189                 if (kbd_dev->console_sess == NULL) {
    190                         kbd_dev->console_sess = sess;
     191                if (kbd_dev->client_sess == NULL) {
     192                        kbd_dev->client_sess = sess;
    191193                        usb_log_debug("%s: OK\n", __FUNCTION__);
    192194                        async_answer_0(icallid, EOK);
     
    292294{
    293295        usb_log_debug2("Sending kbdev event %d/%d to the console\n", type, key);
    294         if (kbd_dev->console_sess == NULL) {
     296        if (kbd_dev->client_sess == NULL) {
    295297                usb_log_warning(
    296298                    "Connection to console not ready, key discarded.\n");
     
    298300        }
    299301
    300         async_exch_t *exch = async_exchange_begin(kbd_dev->console_sess);
     302        async_exch_t *exch = async_exchange_begin(kbd_dev->client_sess);
    301303        if (exch != NULL) {
    302304                async_msg_2(exch, KBDEV_EVENT, type, key);
     
    499501        /* Store the initialized HID device and HID ops
    500502         * to the DDF function. */
    501         fun->ops = &kbd_dev->ops;
     503        fun->ops = &kbdops;
    502504        fun->driver_data = kbd_dev;
    503505
     
    576578        fibril_mutex_initialize(&kbd_dev->repeat_mtx);
    577579        kbd_dev->initialized = USB_KBD_STATUS_UNINITIALIZED;
    578         kbd_dev->ops.default_handler = default_connection_handler;
    579580
    580581        /* Store link to HID device */
     
    737738
    738739        /* Hangup session to the console. */
    739         if (kbd_dev->console_sess)
    740                 async_hangup(kbd_dev->console_sess);
     740        if (kbd_dev->client_sess)
     741                async_hangup(kbd_dev->client_sess);
    741742
    742743        //assert(!fibril_mutex_is_locked((*kbd_dev)->repeat_mtx));
  • uspace/drv/bus/usb/usbhid/kbd/kbddev.h

    r2df6f6fe r948911d  
    8282        unsigned lock_keys;
    8383
    84         /** IPC session to the console device (for sending key events). */
    85         async_sess_t *console_sess;
    86 
    87         /** @todo What is this actually? */
    88         ddf_dev_ops_t ops;
     84        /** IPC session to client (for sending key events). */
     85        async_sess_t *client_sess;
    8986
    9087        /** Information for auto-repeat of keys. */
  • uspace/drv/bus/usb/usbhid/mouse/mousedev.c

    r2df6f6fe r948911d  
    5454#define NAME "mouse"
    5555
    56 /*----------------------------------------------------------------------------*/
    57 
     56static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);
     57
     58static ddf_dev_ops_t ops = { .default_handler = default_connection_handler };
     59
     60/*----------------------------------------------------------------------------*/
    5861const usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description = {
    5962        .transfer_type = USB_TRANSFER_INTERRUPT,
     
    221224                assert(index < mouse_dev->buttons_count);
    222225
    223                 if (mouse_dev->buttons[index] == 0 && field->value != 0) {
     226                if (mouse_dev->buttons[index] != field->value) {
    224227                        async_exch_t *exch =
    225228                            async_exchange_begin(mouse_dev->mouse_sess);
    226229                        if (exch != NULL) {
    227230                                async_req_2_0(exch, MOUSEEV_BUTTON_EVENT,
    228                                     field->usage, 1);
    229                                 async_exchange_end(exch);
    230                                 mouse_dev->buttons[index] = field->value;
    231                         }
    232 
    233                 } else if (mouse_dev->buttons[index] != 0 && field->value == 0) {
    234                         async_exch_t *exch =
    235                             async_exchange_begin(mouse_dev->mouse_sess);
    236                         if (exch != NULL) {
    237                                 async_req_2_0(exch, MOUSEEV_BUTTON_EVENT,
    238                                     field->usage, 0);
     231                                    field->usage, (field->value != 0) ? 1 : 0);
    239232                                async_exchange_end(exch);
    240233                                mouse_dev->buttons[index] = field->value;
     
    279272        }
    280273
    281         fun->ops = &mouse->ops;
     274        fun->ops = &ops;
    282275        fun->driver_data = mouse;
    283276
     
    302295        }
    303296        mouse->mouse_fun = fun;
    304 
    305297        return EOK;
    306298}
     
    379371        }
    380372
    381         // set handler for incoming calls
    382         mouse_dev->ops.default_handler = default_connection_handler;
    383 
    384373        // TODO: how to know if the device supports the request???
    385374        usbhid_req_set_idle(&hid_dev->usb_dev->ctrl_pipe,
  • uspace/drv/bus/usb/usbhid/mouse/mousedev.h

    r2df6f6fe r948911d  
    4646/** Container for USB mouse device. */
    4747typedef struct {
    48         /** IPC session to console (consumer). */
     48        /** IPC session to consumer. */
    4949        async_sess_t *mouse_sess;
    5050
     
    5353        size_t buttons_count;
    5454
    55         ddf_dev_ops_t ops;
    5655        /* DDF mouse function */
    5756        ddf_fun_t *mouse_fun;
  • uspace/lib/drv/generic/remote_usb.c

    r2df6f6fe r948911d  
    5656{
    5757        if (!exch)
    58                 return EINVAL;
     58                return EBADMEM;
    5959        sysarg_t addr;
    6060        const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
     
    7575{
    7676        if (!exch)
    77                 return EINVAL;
     77                return EBADMEM;
    7878        sysarg_t iface_no;
    7979        const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
     
    9292{
    9393        if (!exch)
    94                 return EINVAL;
     94                return EBADMEM;
    9595        devman_handle_t h;
    9696        const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
  • uspace/lib/drv/generic/remote_usbhc.c

    r2df6f6fe r948911d  
    165165{
    166166        if (!exch || !address)
    167                 return EINVAL;
     167                return EBADMEM;
    168168        sysarg_t new_address;
    169169        const int ret = async_req_4_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
     
    178178{
    179179        if (!exch)
    180                 return EINVAL;
     180                return EBADMEM;
    181181        return async_req_3_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    182182            IPC_M_USBHC_BIND_ADDRESS, address, handle);
     
    187187{
    188188        if (!exch)
    189                 return EINVAL;
     189                return EBADMEM;
    190190        sysarg_t h;
    191191        const int ret = async_req_2_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
     
    199199{
    200200        if (!exch)
    201                 return EINVAL;
     201                return EBADMEM;
    202202        return async_req_2_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    203203            IPC_M_USBHC_RELEASE_ADDRESS, address);
     
    209209{
    210210        if (!exch)
    211                 return EINVAL;
     211                return EBADMEM;
    212212        const usb_target_t target =
    213213            {{ .address = address, .endpoint = endpoint }};
     
    225225{
    226226        if (!exch)
    227                 return EINVAL;
     227                return EBADMEM;
    228228        return async_req_4_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    229229            IPC_M_USBHC_UNREGISTER_ENDPOINT, address, endpoint, direction);
     
    234234    size_t *rec_size)
    235235{
     236        if (!exch)
     237                return EBADMEM;
     238
    236239        if (size == 0 && setup == 0)
    237240                return EOK;
    238241
    239         if (!exch)
    240                 return EINVAL;
    241242        const usb_target_t target =
    242243            {{ .address = address, .endpoint = endpoint }};
     
    288289    usb_endpoint_t endpoint, uint64_t setup, const void *data, size_t size)
    289290{
     291        if (!exch)
     292                return EBADMEM;
     293
    290294        if (size == 0 && setup == 0)
    291295                return EOK;
    292296
    293         if (!exch)
    294                 return EINVAL;
    295297        const usb_target_t target =
    296298            {{ .address = address, .endpoint = endpoint }};
Note: See TracChangeset for help on using the changeset viewer.