Lines Matching refs:item

237 	 * If Usage item only includes usage id, concatenate it with
342 * Read data value from item.
345 static u32 item_udata(struct hid_item *item)
347 switch (item->size) {
348 case 1: return item->data.u8;
349 case 2: return item->data.u16;
350 case 4: return item->data.u32;
355 static s32 item_sdata(struct hid_item *item)
357 switch (item->size) {
358 case 1: return item->data.s8;
359 case 2: return item->data.s16;
360 case 4: return item->data.s32;
366 * Process a global item.
369 static int hid_parser_global(struct hid_parser *parser, struct hid_item *item)
372 switch (item->tag) {
396 parser->global.usage_page = item_udata(item);
400 parser->global.logical_minimum = item_sdata(item);
405 parser->global.logical_maximum = item_sdata(item);
407 parser->global.logical_maximum = item_udata(item);
411 parser->global.physical_minimum = item_sdata(item);
416 parser->global.physical_maximum = item_sdata(item);
418 parser->global.physical_maximum = item_udata(item);
426 raw_value = item_sdata(item);
434 parser->global.unit = item_udata(item);
438 parser->global.report_size = item_udata(item);
447 parser->global.report_count = item_udata(item);
456 parser->global.report_id = item_udata(item);
466 hid_err(parser->device, "unknown global tag 0x%x\n", item->tag);
472 * Process a local item.
475 static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
481 data = item_udata(item);
483 switch (item->tag) {
515 return hid_add_usage(parser, data, item->size);
553 if (hid_add_usage(parser, n, item->size)) {
561 dbg_hid("unknown local item tag 0x%x\n", item->tag);
569 * As per specification, 6.2.2.8: "When the parser encounters a main item it
603 * Process a main item.
606 static int hid_parser_main(struct hid_parser *parser, struct hid_item *item)
613 data = item_udata(item);
615 switch (item->tag) {
632 hid_warn(parser->device, "unknown main item tag 0x%x\n", item->tag);
642 * Process a reserved item.
645 static int hid_parser_reserved(struct hid_parser *parser, struct hid_item *item)
647 dbg_hid("reserved item type, tag 0x%x\n", item->tag);
722 * Fetch a report description item from the data stream. We support long
726 static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item)
735 item->type = (b >> 2) & 3;
736 item->tag = (b >> 4) & 15;
738 if (item->tag == HID_ITEM_TAG_LONG) {
740 item->format = HID_ITEM_FORMAT_LONG;
745 item->size = *start++;
746 item->tag = *start++;
748 if ((end - start) < item->size)
751 item->data.longdata = start;
752 start += item->size;
756 item->format = HID_ITEM_FORMAT_SHORT;
757 item->size = b & 3;
759 switch (item->size) {
766 item->data.u8 = *start++;
772 item->data.u16 = get_unaligned_le16(start);
777 item->size++;
780 item->data.u32 = get_unaligned_le32(start);
838 static int hid_scan_main(struct hid_parser *parser, struct hid_item *item)
845 data = item_udata(item);
847 switch (item->tag) {
882 struct hid_item item;
886 struct hid_item *item) = {
905 while ((start = fetch_item(start, end, &item)) != NULL)
906 dispatch_type[item.type](parser, &item);
1205 struct hid_item item;
1214 struct hid_item *item) = {
1268 while ((next = fetch_item(start, end, &item)) != NULL) {
1271 if (item.format != HID_ITEM_FORMAT_SHORT) {
1272 hid_err(device, "unexpected long global item\n");
1276 if (dispatch_type[item.type](parser, &item)) {
1277 hid_err(device, "item %u %u %u %u parsing failed\n",
1278 item.format, (unsigned)item.size,
1279 (unsigned)item.type, (unsigned)item.tag);
1307 hid_err(device, "item fetching failed at offset %u/%u\n",