Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 380e23a3 in mainline


Ignore:
Timestamp:
2014-09-16T21:22:16Z (6 years ago)
Author:
Martin Decky <martin@…>
Branches:
master
Children:
58f26cb
Parents:
5c79fb5
Message:

to actually guarantee mutual exclusion of the kernel and user space input/output, a tri-state logic is required

File:
1 edited

Legend:

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

    r5c79fb5 r380e23a3  
    9090static client_t *active_client = NULL;
    9191
     92/** Kernel override */
     93static bool active = true;
     94
    9295/** List of keyboard devices */
    9396static list_t kbd_devs;
     
    295298
    296299/** Arbitrate client actiovation */
    297 static void client_arbitration(client_t *req)
     300static void client_arbitration(void)
    298301{
    299302        /* Mutual exclusion of active clients */
    300303        list_foreach(clients, link, client_t, client)
    301                 client->active = (client == req);
     304                client->active = ((active) && (client == active_client));
    302305       
    303306        /* Notify clients about the arbitration */
     
    347350                        case INPUT_ACTIVATE:
    348351                                active_client = client;
    349                                 client_arbitration(client);
     352                                client_arbitration();
    350353                                async_answer_0(callid, EOK);
    351354                                break;
     
    362365        if (IPC_GET_ARG1(*call)) {
    363366                /* Kernel console activated */
    364                 client_arbitration(NULL);
     367                active = false;
    365368        } else {
    366369                /* Kernel console deactivated */
    367                 client_arbitration(active_client);
    368         }
     370                active = true;
     371        }
     372       
     373        client_arbitration();
    369374}
    370375
Note: See TracChangeset for help on using the changeset viewer.