Author: mmlr Date: 2011-03-14 21:21:38 +0100 (Mon, 14 Mar 2011) New Revision: 40954 Changeset: http://dev.haiku-os.org/changeset/40954 Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.h haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp Log: * Since the usages of the local state are now processed also for collections there is no need to do the usage page and usage id handling anymore. * As this also removes the only use of the global state it is removed as well. * Try the usage maximum as a fallback as well and print something if none of the usage sources are valid and the collection ends up without a proper usage. Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp 2011-03-14 20:10:01 UTC (rev 40953) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp 2011-03-14 20:21:38 UTC (rev 40954) @@ -18,7 +18,7 @@ HIDCollection::HIDCollection(HIDCollection *parent, uint8 type, - global_item_state &globalState, local_item_state &localState) + local_item_state &localState) : fParent(parent), fType(type), fStringID(localState.string_index), @@ -30,17 +30,14 @@ fItems(NULL) { usage_value usageValue; - usageValue.u.s.usage_page = globalState.usage_page; - if (localState.usage_stack != NULL && localState.usage_stack_used > 0) { - if (localState.usage_stack[0].is_extended) - usageValue.u.extended = localState.usage_stack[0].u.extended; - else - usageValue.u.s.usage_id = localState.usage_stack[0].u.s.usage_id; - } else if (localState.usage_minimum_set) { - if (localState.usage_minimum.is_extended) - usageValue.u.extended = localState.usage_minimum.u.extended; - else - usageValue.u.s.usage_id = localState.usage_minimum.u.s.usage_id; + if (localState.usage_stack != NULL && localState.usage_stack_used > 0) + usageValue.u.extended = localState.usage_stack[0].u.extended; + else if (localState.usage_minimum_set) + usageValue.u.extended = localState.usage_minimum.u.extended; + else if (localState.usage_maximum_set) + usageValue.u.extended = localState.usage_maximum.u.extended; + else { + TRACE_ALWAYS("non of the possible usages for the collection are set\n"); } fUsage = usageValue.u.extended; Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.h 2011-03-14 20:10:01 UTC (rev 40953) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.h 2011-03-14 20:21:38 UTC (rev 40954) @@ -12,8 +12,7 @@ class HIDCollection { public: HIDCollection(HIDCollection *parent, - uint8 type, global_item_state &globalState, - local_item_state &localState); + uint8 type, local_item_state &localState); ~HIDCollection(); HIDCollection * Parent() { return fParent; }; Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp 2011-03-14 20:10:01 UTC (rev 40953) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp 2011-03-14 20:21:38 UTC (rev 40954) @@ -132,7 +132,7 @@ if (item->tag == ITEM_TAG_MAIN_COLLECTION) { HIDCollection *newCollection = new(std::nothrow) HIDCollection(collection, - (uint8)data, globalState, localState); + (uint8)data, localState); if (newCollection == NULL) { TRACE_ALWAYS("no memory to allocate new collection\n"); break;