Changes in uspace/app/usbinfo/info.c [b1c6e58:0f21c0c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/usbinfo/info.c
rb1c6e58 r0f21c0c 129 129 config_descriptor.total_length); 130 130 131 /*132 * Get supported languages of STRING descriptors.133 */134 l18_win_locales_t *langs;135 size_t langs_count;136 rc = usb_request_get_supported_languages(&ctrl_pipe,137 &langs, &langs_count);138 if (rc != EOK) {139 fprintf(stderr,140 NAME ": failed to get list of supported languages: %s.\n",141 str_error(rc));142 goto skip_strings;143 }144 145 printf("String languages (%zu):", langs_count);146 size_t i;147 for (i = 0; i < langs_count; i++) {148 printf(" 0x%04x", (int) langs[i]);149 }150 printf(".\n");151 152 /*153 * Dump all strings in all available langages;154 */155 for (i = 0; i < langs_count; i++) {156 l18_win_locales_t lang = langs[i];157 158 printf("%sStrings for language 0x%04x:\n", get_indent(0),159 (int) lang);160 161 /*162 * Try all indexes - we will see what pops-up ;-).163 * However, to speed things up, we will stop after164 * encountering several broken (or nonexistent ones)165 * descriptors in line.166 */167 size_t idx;168 size_t failed_count = 0;169 for (idx = 1; idx < 0xFF; idx++) {170 char *string;171 rc = usb_request_get_string(&ctrl_pipe, idx, lang,172 &string);173 if (rc != EOK) {174 failed_count++;175 if (failed_count > 3) {176 break;177 }178 continue;179 }180 printf("%sString #%zu: \"%s\"\n", get_indent(1),181 idx, string);182 free(string);183 failed_count = 0; /* Reset failed counter. */184 }185 }186 187 188 skip_strings:189 190 131 rc = EOK; 191 192 132 leave: 193 133 /* Ignoring errors here. */
Note:
See TracChangeset
for help on using the changeset viewer.