Ignore:
File:
1 edited

Legend:

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

    rf03d3786 r700af62  
    741741}
    742742
    743 /** Try to connect to given keyboard, bypassing provided libc routines.
    744  *
    745  * @param devmap_path Path to keyboard without /dev prefix.
    746  * @return Phone or error code.
    747  */
    748 static int connect_keyboard_bypass(char *devmap_path)
    749 {
    750         int devmap_phone = async_connect_me_to_blocking(PHONE_NS,
    751             SERVICE_DEVMAP, DEVMAP_CLIENT, 0);
    752         if (devmap_phone < 0) {
    753                 return devmap_phone;
    754         }
    755         ipc_call_t answer;
    756         aid_t req = async_send_2(devmap_phone, DEVMAP_DEVICE_GET_HANDLE,
    757             0, 0,  &answer);
    758 
    759         sysarg_t retval = async_data_write_start(devmap_phone,
    760             devmap_path, str_size(devmap_path));
    761         if (retval != EOK) {
    762                 async_wait_for(req, NULL);
    763                 ipc_hangup(devmap_phone);
    764                 return retval;
    765         }
    766 
    767         async_wait_for(req, &retval);
    768 
    769         if (retval != EOK) {
    770                 ipc_hangup(devmap_phone);
    771                 return retval;
    772         }
    773 
    774         devmap_handle_t handle = (devmap_handle_t) IPC_GET_ARG1(answer);
    775 
    776         ipc_hangup(devmap_phone);
    777 
    778         int phone = async_connect_me_to(PHONE_NS,
    779             SERVICE_DEVMAP, DEVMAP_CONNECT_TO_DEVICE, handle);
    780         if (phone < 0) {
    781                 return phone;
    782         }
    783 
    784         /* NB: The callback connection is slotted for removal */
    785         sysarg_t phonehash;
    786         int rc = async_req_3_5(phone, IPC_M_CONNECT_TO_ME, SERVICE_CONSOLE,
    787             0, 0, NULL, NULL, NULL, NULL, &phonehash);
    788         if (rc != EOK) {
    789                 printf(NAME ": Failed to create callback from input device\n");
    790                 return rc;
    791         }
    792 
    793         async_new_connection(phonehash, 0, NULL, keyboard_events);
    794 
    795         printf(NAME ": we got a hit (new keyboard \"/dev/%s\").\n",
    796             devmap_path);
    797 
    798         return phone;
    799 }
    800 
    801743
    802744static int check_new_keyboards(void *arg)
     
    809751                async_usleep(1 * 500 * 1000);
    810752                char *path;
    811                 int rc = asprintf(&path, "class/%s\\%d", class_name, index);
     753                int rc = asprintf(&path, "/dev/class/%s\\%d", class_name, index);
    812754                if (rc < 0) {
    813755                        continue;
    814756                }
    815757                rc = 0;
    816                 rc = connect_keyboard_bypass(path);
     758                rc = connect_keyboard(path);
    817759                if (rc > 0) {
    818760                        /* We do not allow unplug. */
Note: See TracChangeset for help on using the changeset viewer.