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


Ignore:
Location:
uspace
Files:
6 edited

Legend:

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

    r948911d r2df6f6fe  
    7171#include "../usbhid.h"
    7272
    73 static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);
    74 static ddf_dev_ops_t kbdops = { .default_handler = default_connection_handler };
    7573/*----------------------------------------------------------------------------*/
    7674
     
    189187                        break;
    190188                }
    191                 if (kbd_dev->client_sess == NULL) {
    192                         kbd_dev->client_sess = sess;
     189                if (kbd_dev->console_sess == NULL) {
     190                        kbd_dev->console_sess = sess;
    193191                        usb_log_debug("%s: OK\n", __FUNCTION__);
    194192                        async_answer_0(icallid, EOK);
     
    294292{
    295293        usb_log_debug2("Sending kbdev event %d/%d to the console\n", type, key);
    296         if (kbd_dev->client_sess == NULL) {
     294        if (kbd_dev->console_sess == NULL) {
    297295                usb_log_warning(
    298296                    "Connection to console not ready, key discarded.\n");
     
    300298        }
    301299
    302         async_exch_t *exch = async_exchange_begin(kbd_dev->client_sess);
     300        async_exch_t *exch = async_exchange_begin(kbd_dev->console_sess);
    303301        if (exch != NULL) {
    304302                async_msg_2(exch, KBDEV_EVENT, type, key);
     
    501499        /* Store the initialized HID device and HID ops
    502500         * to the DDF function. */
    503         fun->ops = &kbdops;
     501        fun->ops = &kbd_dev->ops;
    504502        fun->driver_data = kbd_dev;
    505503
     
    578576        fibril_mutex_initialize(&kbd_dev->repeat_mtx);
    579577        kbd_dev->initialized = USB_KBD_STATUS_UNINITIALIZED;
     578        kbd_dev->ops.default_handler = default_connection_handler;
    580579
    581580        /* Store link to HID device */
     
    738737
    739738        /* Hangup session to the console. */
    740         if (kbd_dev->client_sess)
    741                 async_hangup(kbd_dev->client_sess);
     739        if (kbd_dev->console_sess)
     740                async_hangup(kbd_dev->console_sess);
    742741
    743742        //assert(!fibril_mutex_is_locked((*kbd_dev)->repeat_mtx));
  • uspace/drv/bus/usb/usbhid/kbd/kbddev.h

    r948911d r2df6f6fe  
    8282        unsigned lock_keys;
    8383
    84         /** IPC session to client (for sending key events). */
    85         async_sess_t *client_sess;
     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;
    8689
    8790        /** Information for auto-repeat of keys. */
  • uspace/drv/bus/usb/usbhid/mouse/mousedev.c

    r948911d r2df6f6fe  
    5454#define NAME "mouse"
    5555
    56 static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);
    57 
    58 static ddf_dev_ops_t ops = { .default_handler = default_connection_handler };
    59 
    60 /*----------------------------------------------------------------------------*/
     56/*----------------------------------------------------------------------------*/
     57
    6158const usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description = {
    6259        .transfer_type = USB_TRANSFER_INTERRUPT,
     
    224221                assert(index < mouse_dev->buttons_count);
    225222
    226                 if (mouse_dev->buttons[index] != field->value) {
     223                if (mouse_dev->buttons[index] == 0 && field->value != 0) {
    227224                        async_exch_t *exch =
    228225                            async_exchange_begin(mouse_dev->mouse_sess);
    229226                        if (exch != NULL) {
    230227                                async_req_2_0(exch, MOUSEEV_BUTTON_EVENT,
    231                                     field->usage, (field->value != 0) ? 1 : 0);
     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);
    232239                                async_exchange_end(exch);
    233240                                mouse_dev->buttons[index] = field->value;
     
    272279        }
    273280
    274         fun->ops = &ops;
     281        fun->ops = &mouse->ops;
    275282        fun->driver_data = mouse;
    276283
     
    295302        }
    296303        mouse->mouse_fun = fun;
     304
    297305        return EOK;
    298306}
     
    371379        }
    372380
     381        // set handler for incoming calls
     382        mouse_dev->ops.default_handler = default_connection_handler;
     383
    373384        // TODO: how to know if the device supports the request???
    374385        usbhid_req_set_idle(&hid_dev->usb_dev->ctrl_pipe,
  • uspace/drv/bus/usb/usbhid/mouse/mousedev.h

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

    r948911d r2df6f6fe  
    5656{
    5757        if (!exch)
    58                 return EBADMEM;
     58                return EINVAL;
    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 EBADMEM;
     77                return EINVAL;
    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 EBADMEM;
     94                return EINVAL;
    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

    r948911d r2df6f6fe  
    165165{
    166166        if (!exch || !address)
    167                 return EBADMEM;
     167                return EINVAL;
    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 EBADMEM;
     180                return EINVAL;
    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 EBADMEM;
     189                return EINVAL;
    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 EBADMEM;
     201                return EINVAL;
    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 EBADMEM;
     211                return EINVAL;
    212212        const usb_target_t target =
    213213            {{ .address = address, .endpoint = endpoint }};
     
    225225{
    226226        if (!exch)
    227                 return EBADMEM;
     227                return EINVAL;
    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 
    239236        if (size == 0 && setup == 0)
    240237                return EOK;
    241238
     239        if (!exch)
     240                return EINVAL;
    242241        const usb_target_t target =
    243242            {{ .address = address, .endpoint = endpoint }};
     
    289288    usb_endpoint_t endpoint, uint64_t setup, const void *data, size_t size)
    290289{
    291         if (!exch)
    292                 return EBADMEM;
    293 
    294290        if (size == 0 && setup == 0)
    295291                return EOK;
    296292
     293        if (!exch)
     294                return EINVAL;
    297295        const usb_target_t target =
    298296            {{ .address = address, .endpoint = endpoint }};
Note: See TracChangeset for help on using the changeset viewer.