Changeset 7eebe2a in mainline
- Timestamp:
- 2011-02-23T21:23:44Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b84e114
- Parents:
- 1a6a234
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/usbinfo/info.c
r1a6a234 r7eebe2a 130 130 131 131 /* 132 * Dump STRING languages. 133 */ 134 uint8_t *string_descriptor = NULL; 135 size_t string_descriptor_size = 0; 136 rc = usb_request_get_descriptor_alloc(&ctrl_pipe, 137 USB_REQUEST_TYPE_STANDARD, USB_DESCTYPE_STRING, 0, 0, 138 (void **) &string_descriptor, &string_descriptor_size); 139 if (rc != EOK) { 140 fprintf(stderr, 141 NAME ": failed to fetch language table: %s.\n", 142 str_error(rc)); 143 goto leave; 144 } 145 if ((string_descriptor_size <= 2) 146 || ((string_descriptor_size % 2) != 0)) { 147 fprintf(stderr, NAME ": No supported languages.\n"); 148 goto leave; 149 } 150 151 size_t lang_count = (string_descriptor_size - 2) / 2; 152 int *lang_codes = malloc(sizeof(int) * lang_count); 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); 153 146 size_t i; 154 for (i = 0; i < lang_count; i++) { 155 lang_codes[i] = (string_descriptor[2 + 2 * i + 1] << 8) 156 + string_descriptor[2 + 2 * i]; 157 } 158 159 printf("String languages:"); 160 for (i = 0; i < lang_count; i++) { 161 printf(" 0x%04x", lang_codes[i]); 147 for (i = 0; i < langs_count; i++) { 148 printf(" 0x%04x", (int) langs[i]); 162 149 } 163 150 printf(".\n"); 164 165 free(string_descriptor);166 free(lang_codes);167 151 168 152 /* … … 227 211 } 228 212 213 skip_strings: 214 229 215 rc = EOK; 230 216
Note:
See TracChangeset
for help on using the changeset viewer.