Changeset 9fe1635 in mainline for uspace/srv/hid/input/input.c
- Timestamp:
- 2019-05-16T08:00:04Z (5 years ago)
- Children:
- 4db37d1
- Parents:
- e89dc0b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/input/input.c
re89dc0b r9fe1635 110 110 } 111 111 112 static void layout_load(const char *layout_name) 113 { 114 /* 115 async_get_call(ipc_call_t *); 116 ipc_get_arg1(ipc_call_t *); 117 */ 118 const char *prefix = "/lib/layouts/"; 112 static errno_t layout_load(const char *layout_name) 113 { 114 #ifdef CONFIG_RTLD 115 const char *prefix = "layouts/"; 119 116 const char *suffix = ".so"; 120 117 size_t length = 1; … … 122 119 length += str_size(suffix); 123 120 length += str_size(layout_name); 124 char *path = malloc(sizeof(char) * length);125 121 char *path = malloc(sizeof(char) * (length + 1)); 122 126 123 if (path == NULL) { 127 124 printf("%s: Error allocating layout path. Out of memory.\n", NAME); 128 return; 129 } 130 125 return ENOMEM; 126 } 127 128 path[0] = '\0'; 131 129 str_append(path, length, prefix); 132 130 str_append(path, length, layout_name); 133 131 str_append(path, length, suffix); 132 printf("%s\n", path); 134 133 135 134 void *handle = dlopen(path, 0); 136 135 if (handle == NULL) { 137 136 printf("%s: Keyboard layout could not be found.\n", NAME); 138 return ;139 } 140 141 layout_ops_t (*get_layout)(void) = dlsym(handle, " dl_get_constant");137 return ENOENT; 138 } 139 140 layout_ops_t (*get_layout)(void) = dlsym(handle, "get_layout"); 142 141 143 142 if (get_layout == NULL) { 144 143 printf("%s: Keyboard layout constructor could not be found.\n", NAME); 145 return ;144 return ENOENT; 146 145 } 147 146 148 147 layout_active = get_layout(); 149 148 layout_change(&layout_active); 149 #endif 150 151 return EOK; 150 152 } 151 153 … … 379 381 break; 380 382 case INPUT_CHANGE_LAYOUT: { 381 char * layout_name = (char *)ipc_get_arg1(&call); 382 layout_load(layout_name); 383 void * layout_name; 384 errno_t ret = async_data_write_accept(&layout_name, true, 0, 0, 0, 0); 385 if (ret != EOK) { 386 async_answer_0(&call, ret); 387 break; 388 } 389 390 errno_t retval = layout_load((char *)layout_name); 383 391 free(layout_name); 392 async_answer_0(&call, retval); 384 393 break; 385 394 }
Note:
See TracChangeset
for help on using the changeset viewer.