Lines 138-143
Link Here
|
138 |
void set_keyboard(char *device); |
138 |
void set_keyboard(char *device); |
139 |
void set_keyrates(char *opt); |
139 |
void set_keyrates(char *opt); |
140 |
void show_kbd_info(void); |
140 |
void show_kbd_info(void); |
|
|
141 |
void show_mux_info(void); |
141 |
void usage(void) __dead2; |
142 |
void usage(void) __dead2; |
142 |
|
143 |
|
143 |
char * |
144 |
char * |
Lines 1011-1016
Link Here
|
1011 |
return "unknown"; |
1012 |
return "unknown"; |
1012 |
} |
1013 |
} |
1013 |
|
1014 |
|
|
|
1015 |
static void |
1016 |
print_kbd_info(keyboard_info_t *info) |
1017 |
{ |
1018 |
printf("%.*s%d, type:%s (%d)\n", |
1019 |
(int)sizeof(info->kb_name), info->kb_name, info->kb_unit, |
1020 |
get_kbd_type_name(info->kb_type), info->kb_type); |
1021 |
} |
1022 |
|
1023 |
static void |
1024 |
print_kbd_info_extended(keyboard_info_t *info) |
1025 |
{ |
1026 |
printf("kbd%d:\n", info->kb_index); |
1027 |
printf(" "); |
1028 |
print_kbd_info(info); |
1029 |
} |
1030 |
|
1014 |
void |
1031 |
void |
1015 |
show_kbd_info(void) |
1032 |
show_kbd_info(void) |
1016 |
{ |
1033 |
{ |
Lines 1020-1032
Link Here
|
1020 |
warn("unable to obtain keyboard information"); |
1037 |
warn("unable to obtain keyboard information"); |
1021 |
return; |
1038 |
return; |
1022 |
} |
1039 |
} |
1023 |
printf("kbd%d:\n", info.kb_index); |
1040 |
print_kbd_info_extended(&info); |
1024 |
printf(" %.*s%d, type:%s (%d)\n", |
|
|
1025 |
(int)sizeof(info.kb_name), info.kb_name, info.kb_unit, |
1026 |
get_kbd_type_name(info.kb_type), info.kb_type); |
1027 |
} |
1041 |
} |
1028 |
|
1042 |
|
1029 |
void |
1043 |
void |
|
|
1044 |
show_mux_info(void) |
1045 |
{ |
1046 |
int i; |
1047 |
keyboard_info_t info_mux; |
1048 |
|
1049 |
keyboard_info_array_t *info_arr = (keyboard_info_array_t*) |
1050 |
malloc(IOCPARM_MAX); |
1051 |
info_arr->len = IOCPARM_MAX; |
1052 |
|
1053 |
if (ioctl(0, KDGKBINFO, &info_mux) == -1) { |
1054 |
warn("unable to obtain keyboard information"); |
1055 |
free(info_arr); |
1056 |
return; |
1057 |
} |
1058 |
if (ioctl(0, KBLSTKBD, info_arr) == -1) { |
1059 |
warn("unable to obtain keyboard multiplexer information"); |
1060 |
free(info_arr); |
1061 |
return; |
1062 |
} |
1063 |
|
1064 |
printf("Keyboard multiplexor kbd%d: ", info_mux.kb_index); |
1065 |
print_kbd_info(&info_mux); |
1066 |
for (i=0; i<info_arr->len; i++) { |
1067 |
printf(" part[%i]: kbd%d: ", i, info_arr->kbs[i].kb_index); |
1068 |
print_kbd_info(&info_arr->kbs[i]); |
1069 |
} |
1070 |
|
1071 |
free(info_arr); |
1072 |
} |
1073 |
|
1074 |
void |
1030 |
set_keyboard(char *device) |
1075 |
set_keyboard(char *device) |
1031 |
{ |
1076 |
{ |
1032 |
keyboard_info_t info; |
1077 |
keyboard_info_t info; |
Lines 1050-1059
Link Here
|
1050 |
ioctl(fd, CONS_RELKBD, 0); |
1095 |
ioctl(fd, CONS_RELKBD, 0); |
1051 |
close(fd); |
1096 |
close(fd); |
1052 |
#if 1 |
1097 |
#if 1 |
1053 |
printf("kbd%d\n", info.kb_index); |
1098 |
print_kbd_info_extended(&info); |
1054 |
printf(" %.*s%d, type:%s (%d)\n", |
|
|
1055 |
(int)sizeof(info.kb_name), info.kb_name, info.kb_unit, |
1056 |
get_kbd_type_name(info.kb_type), info.kb_type); |
1057 |
#endif |
1099 |
#endif |
1058 |
|
1100 |
|
1059 |
if (ioctl(0, CONS_SETKBD, info.kb_index) == -1) |
1101 |
if (ioctl(0, CONS_SETKBD, info.kb_index) == -1) |
Lines 1074-1083
Link Here
|
1074 |
return; |
1116 |
return; |
1075 |
} |
1117 |
} |
1076 |
#if 1 |
1118 |
#if 1 |
1077 |
printf("kbd%d\n", info.kb_index); |
1119 |
print_kbd_info_extended(&info); |
1078 |
printf(" %.*s%d, type:%s (%d)\n", |
|
|
1079 |
(int)sizeof(info.kb_name), info.kb_name, info.kb_unit, |
1080 |
get_kbd_type_name(info.kb_type), info.kb_type); |
1081 |
#endif |
1120 |
#endif |
1082 |
if (ioctl(0, CONS_RELKBD, 0) == -1) |
1121 |
if (ioctl(0, CONS_RELKBD, 0) == -1) |
1083 |
warn("unable to release the keyboard"); |
1122 |
warn("unable to release the keyboard"); |
Lines 1098-1107
Link Here
|
1098 |
return; |
1137 |
return; |
1099 |
} |
1138 |
} |
1100 |
#if 1 |
1139 |
#if 1 |
1101 |
printf("kbd%d\n", info.kb_index); |
1140 |
print_kbd_info_extended(&info); |
1102 |
printf(" %.*s%d, type:%s (%d)\n", |
|
|
1103 |
(int)sizeof(info.kb_name), info.kb_name, info.kb_unit, |
1104 |
get_kbd_type_name(info.kb_type), info.kb_type); |
1105 |
#endif |
1141 |
#endif |
1106 |
/* |
1142 |
/* |
1107 |
* split kbd into name and unit. find the right most part of the |
1143 |
* split kbd into name and unit. find the right most part of the |
Lines 1163-1169
Link Here
|
1163 |
{ |
1199 |
{ |
1164 |
int opt; |
1200 |
int opt; |
1165 |
|
1201 |
|
1166 |
while((opt = getopt(argc, argv, "A:a:b:df:iKk:Fl:L:r:x")) != -1) |
1202 |
while((opt = getopt(argc, argv, "A:a:b:df:iIKk:Fl:L:r:x")) != -1) |
1167 |
switch(opt) { |
1203 |
switch(opt) { |
1168 |
case 'A': |
1204 |
case 'A': |
1169 |
case 'a': |
1205 |
case 'a': |
Lines 1191-1196
Link Here
|
1191 |
case 'i': |
1227 |
case 'i': |
1192 |
show_kbd_info(); |
1228 |
show_kbd_info(); |
1193 |
break; |
1229 |
break; |
|
|
1230 |
case 'I': |
1231 |
show_mux_info(); |
1232 |
break; |
1194 |
case 'K': |
1233 |
case 'K': |
1195 |
release_keyboard(); |
1234 |
release_keyboard(); |
1196 |
break; |
1235 |
break; |