uint32_t Keylayout_real_start(void) { char layoutPath[512]; const char *val; int len; if (getValueForKey("KeyLayout", &val, &len, DEFAULT_BOOT_CONFIG)) { snprintf(layoutPath, sizeof(layoutPath),"/Extra/Keymaps/%s", val); // Add the extension if needed if (len <= 4 || strncmp(val+len-4,".lyt", sizeof(".lyt")) != 0) strlcat(layoutPath, ".lyt", sizeof(layoutPath)); if (!load_keyboard_layout_file(layoutPath)) { DBG("Can't load %s keyboard layout file. Keylayout will not be used !\n", layoutPath); return 0; } if (replace_system_function("_getc", &getchar_replacement) != EFI_SUCCESS ) { printf("no function getc() to replace. Keylayout will not be used ! \n"); return 0; } return 1; } return 0; }
void Keylayout_start() { char layoutPath[512]; const char *val; int len; if (getValueForKey("KeyLayout", &val, &len, &bootInfo->chameleonConfig)) { sprintf(layoutPath, "/Extra/Keymaps/%s", val); // Add the extension if needed if (len <= 4 || strcmp(val+len-4,".lyt") != 0) strncat(layoutPath, ".lyt", sizeof(layoutPath) - strlen(layoutPath) - 1); if (!load_keyboard_layout_file(layoutPath)) { printf("Can't load %s keyboard layout file. Keylayout will not be used !\n", layoutPath); sleep(2); } else if (!replace_function("_getchar", &getchar_replacement)) { printf("Can't replace function getchar: Keylayout module can't be used !\n"); sleep(2); } } }