Changeset 07525cd in mainline
- Timestamp:
- 2013-09-10T18:34:16Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 08bc23d
- Parents:
- 85147f3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/adt/list.h
r85147f3 r07525cd 68 68 69 69 #define list_foreach(list, member, itype, iterator) \ 70 for (itype *iterator = NULL; iterator == NULL; iterator = (itype *)1) \70 for (itype *iterator = NULL; iterator == NULL; iterator = (itype *) 1) \ 71 71 for (link_t *_link = (list).head.next; \ 72 72 iterator = list_get_instance(_link, itype, member), \ -
uspace/lib/c/include/adt/list.h
r85147f3 r07525cd 68 68 69 69 #define list_foreach(list, member, itype, iterator) \ 70 for (itype *iterator = NULL; iterator == NULL; iterator = (itype *)1) \70 for (itype *iterator = NULL; iterator == NULL; iterator = (itype *) 1) \ 71 71 for (link_t *_link = (list).head.next; \ 72 72 iterator = list_get_instance(_link, itype, member), \ … … 74 74 75 75 /** Unlike list_foreach(), allows removing items while traversing a list. 76 * 76 * 77 77 * @code 78 78 * list_t mylist; … … 249 249 * 250 250 * @return Next item or NULL if @a link is the last item. 251 * 251 252 */ 252 253 static inline link_t *list_next(link_t *link, const list_t *list) … … 261 262 * 262 263 * @return Previous item or NULL if @a link is the first item. 264 * 263 265 */ 264 266 static inline link_t *list_prev(link_t *link, const list_t *list) -
uspace/lib/usbhid/src/hidparser.c
r85147f3 r07525cd 132 132 usb_hid_report_description_t *report_des; 133 133 usb_hid_report_type_t type = USB_HID_REPORT_TYPE_INPUT; 134 134 135 135 if (report == NULL) { 136 136 return EINVAL; … … 155 155 156 156 if (USB_HID_ITEM_FLAG_CONSTANT(item->item_flags) == 0) { 157 157 158 158 if (USB_HID_ITEM_FLAG_VARIABLE(item->item_flags) == 0) { 159 159 /* array */ 160 160 item->value = 161 161 usb_hid_translate_data(item, data); 162 162 163 163 item->usage = USB_HID_EXTENDED_USAGE( 164 164 item->usages[item->value - … … 185 185 } 186 186 } 187 187 188 188 return EOK; 189 189 } … … 340 340 int length; 341 341 int32_t tmp_value; 342 342 343 343 if (report == NULL) { 344 344 return EINVAL; … … 352 352 report_des = usb_hid_report_find_description(report, report_id, 353 353 USB_HID_REPORT_TYPE_OUTPUT); 354 354 355 355 if (report_des == NULL) { 356 356 return EINVAL; … … 364 364 offset = report_des->bit_length - report_item->offset - 1; 365 365 length = report_item->size; 366 366 367 367 usb_log_debug("\ttranslated value: %x\n", value); 368 368 … … 375 375 value = value << shift; 376 376 value = value & (((1 << length) - 1) << shift); 377 377 378 378 uint8_t mask = 0; 379 379 mask = 0xff - (((1 << length) - 1) << shift); … … 391 391 392 392 tmp_value = tmp_value << (offset % 8); 393 393 394 394 mask = ~(((1 << (8 - (offset % 8))) - 1) 395 395 << (offset % 8)); … … 398 398 tmp_value; 399 399 } else if (i == ((offset + length - 1) / 8)) { 400 400 401 401 value = value >> (length - 402 402 ((offset + length) % 8)); … … 404 404 value = value & ((1 << (length - 405 405 ((offset + length) % 8))) - 1); 406 406 407 407 mask = (1 << (length - 408 408 ((offset + length) % 8))) - 1; … … 418 418 report_item->value = 0; 419 419 } 420 420 421 421 return EOK; 422 422 } -
uspace/lib/usbhid/src/hidpath.c
r85147f3 r07525cd 237 237 usb_hid_report_usage_path_t, report_item) { 238 238 239 if(USB_HID_SAME_USAGE_PAGE(report_item->usage_page, 240 path_item->usage_page)){ 241 242 if(only_page == 0){ 243 if(USB_HID_SAME_USAGE( 244 report_item->usage, 245 path_item->usage)) { 246 239 if (USB_HID_SAME_USAGE_PAGE(report_item->usage_page, 240 path_item->usage_page)) { 241 242 if (only_page == 0) { 243 if (USB_HID_SAME_USAGE(report_item->usage, 244 path_item->usage)) 247 245 return EOK; 248 }249 246 } 250 247 else { … … 268 265 report_link = report_path->items.head.next; 269 266 path_link = path->items.head.next; 270 271 while ((report_link != &report_path->items.head) &&272 273 267 268 while ((report_link != &report_path->items.head) && 269 (path_link != &path->items.head)) { 270 274 271 report_item = list_get_instance(report_link, 275 276 272 usb_hid_report_usage_path_t, rpath_items_link); 273 277 274 path_item = list_get_instance(path_link, 278 275 usb_hid_report_usage_path_t, rpath_items_link); 279 276 280 if (!USB_HID_SAME_USAGE_PAGE(report_item->usage_page,281 277 if (!USB_HID_SAME_USAGE_PAGE(report_item->usage_page, 278 path_item->usage_page) || ((only_page == 0) && 282 279 !USB_HID_SAME_USAGE(report_item->usage, 283 path_item->usage))) { 284 280 path_item->usage))) { 285 281 return 1; 286 282 } else { … … 290 286 } 291 287 292 if((((flags & USB_HID_PATH_COMPARE_BEGIN) != 0) && 293 (path_link == &path->items.head)) || 294 ((report_link == &report_path->items.head) && 295 (path_link == &path->items.head))) { 296 288 if ((((flags & USB_HID_PATH_COMPARE_BEGIN) != 0) && 289 (path_link == &path->items.head)) || 290 ((report_link == &report_path->items.head) && 291 (path_link == &path->items.head))) { 297 292 return EOK; 298 } 299 else { 293 } else { 300 294 return 1; 301 } 295 } 302 296 break; 303 297
Note:
See TracChangeset
for help on using the changeset viewer.