Changeset 9fe1635 in mainline
- Timestamp:
- 2019-05-16T08:00:04Z (6 years ago)
- Children:
- 4db37d1
- Parents:
- e89dc0b
- Location:
- uspace
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/init/init.c
re89dc0b r9fe1635 48 48 #include <io/logctl.h> 49 49 #include <vol.h> 50 #include <ipc/services.h> 50 51 #include "untar.h" 51 52 #include "init.h" … … 65 66 #define SRV_COMPOSITOR "/srv/hid/compositor" 66 67 67 #define HID_INPUT "hid/input"68 #define HID_INPUT SERVICE_NAME_HID_INPUT 68 69 #define HID_OUTPUT "hid/output" 69 70 #define HID_COMPOSITOR_SERVER ":0" -
uspace/lib/c/include/ipc/services.h
re89dc0b r9fe1635 58 58 #define SERVICE_NAME_INET "net/inet" 59 59 #define SERVICE_NAME_IPC_TEST "ipc-test" 60 #define SERVICE_NAME_HID_INPUT "hid/input" 60 61 #define SERVICE_NAME_NETCONF "net/netconf" 61 62 #define SERVICE_NAME_UDP "net/udp" -
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 } -
uspace/srv/hid/input/input.h
re89dc0b r9fe1635 41 41 #include <stdbool.h> 42 42 #include <async.h> 43 #include <ipc/services.h> 43 44 44 #define NAME "input"45 #define NAME SERVICE_NAME_HID_INPUT 45 46 46 47 extern bool irc_service;
Note:
See TracChangeset
for help on using the changeset viewer.