Changeset aad3587 in mainline for uspace/app/usbinfo/info.c
- Timestamp:
- 2011-03-17T23:10:26Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2d6787b
- Parents:
- 7b13d8e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/usbinfo/info.c
r7b13d8e raad3587 200 200 } 201 201 202 void dump_strings(usbinfo_device_t *dev) 203 { 204 /* Get supported languages. */ 205 l18_win_locales_t *langs; 206 size_t langs_count; 207 int rc = usb_request_get_supported_languages(&dev->ctrl_pipe, 208 &langs, &langs_count); 209 if (rc != EOK) { 210 fprintf(stderr, 211 NAME ": failed to get list of supported languages: %s.\n", 212 str_error(rc)); 213 return; 214 } 215 216 printf("%sString languages (%zu):", get_indent(0), langs_count); 217 size_t i; 218 for (i = 0; i < langs_count; i++) { 219 printf(" 0x%04x", (int) langs[i]); 220 } 221 printf(".\n"); 222 223 /* Get all strings and dump them. */ 224 for (i = 0; i < langs_count; i++) { 225 l18_win_locales_t lang = langs[i]; 226 227 printf("%sStrings for language 0x%04x:\n", get_indent(0), 228 (int) lang); 229 /* 230 * Try only the first 15 strings 231 * (typically, device will not have much more anyway). 232 */ 233 size_t idx; 234 for (idx = 1; idx < 0x0F; idx++) { 235 char *string; 236 rc = usb_request_get_string(&dev->ctrl_pipe, idx, lang, 237 &string); 238 if (rc != EOK) { 239 continue; 240 } 241 printf("%sString #%zu: \"%s\"\n", get_indent(1), 242 idx, string); 243 free(string); 244 } 245 } 246 } 247 202 248 int dump_device(devman_handle_t hc_handle, usb_address_t address) 203 249 {
Note:
See TracChangeset
for help on using the changeset viewer.