Changeset 5f7b75a in mainline
- Timestamp:
- 2011-05-06T16:18:30Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 45a2688, ba17f5b
- Parents:
- 1be39e9
- Location:
- uspace/lib/usb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/classes/hidpath.h
r1be39e9 r5f7b75a 44 44 */ 45 45 /** Wanted usage path must be exactly the same as the searched one */ 46 #define USB_HID_PATH_COMPARE_STRICT 46 #define USB_HID_PATH_COMPARE_STRICT 0 47 47 /** Wanted usage path must be the suffix in the searched one */ 48 #define USB_HID_PATH_COMPARE_END 48 #define USB_HID_PATH_COMPARE_END 1 49 49 /** */ 50 #define USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY 4 51 #define USB_HID_PATH_COMPARE_COLLECTION_ONLY 2 /* porovnava jenom cestu z Kolekci */ 50 #define USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY 2 52 51 /** Searched usage page must be prefix of the other one */ 53 #define USB_HID_PATH_COMPARE_BEGIN 852 #define USB_HID_PATH_COMPARE_BEGIN 4 54 53 /** Searched couple of usage page and usage can be anywhere in usage path */ 55 #define USB_HID_PATH_COMPARE_WHERE 16 56 /** 57 * TODO 58 * * porovnani zacatek - neni to to samy jako COLLECTION ONLY?? -- TEST 59 * * porovnani kdekoliv (jenom s delkou 1 at si to moc nekomplikujem) 60 */ 54 #define USB_HID_PATH_COMPARE_ANYWHERE 8 61 55 62 56 -
uspace/lib/usb/src/hidpath.c
r1be39e9 r5f7b75a 149 149 usb_log_debug("\tFLAGS: %d\n", path_item->flags); 150 150 151 item = item->next;151 item = item->next; 152 152 } 153 153 } … … 156 156 * Compares two usage paths structures 157 157 * 158 * If USB_HID_PATH_COMPARE_COLLECTION_ONLY flag is given, the last item in report_path structure is forgotten 159 * 160 * @param report_path usage path structure to compare 158 * 159 * @param report_path usage path structure to compare with @path 161 160 * @param path usage patrh structure to compare 162 161 * @param flags Flags determining the mode of comparison … … 179 178 } 180 179 180 // Empty path match all others 181 181 if(path->depth == 0){ 182 182 return EOK; … … 189 189 190 190 switch(flags){ 191 /* path must be completly identical */ 191 /* path is somewhere in report_path */ 192 case USB_HID_PATH_COMPARE_ANYWHERE: 193 if(path->depth != 1){ 194 return 1; 195 } 196 197 // projit skrz cestu a kdyz nekde sedi tak vratim EOK 198 // dojduli az za konec tak nnesedi 199 report_link = report_path->head.next; 200 path_link = path->head.next; 201 path_item = list_get_instance(path_link, usb_hid_report_usage_path_t, link); 202 203 while(report_link != &report_path->head) { 204 report_item = list_get_instance(report_link, usb_hid_report_usage_path_t, link); 205 if(report_item->usage_page == path_item->usage_page){ 206 if(only_page == 0){ 207 if(report_item->usage == path_item->usage) { 208 return EOK; 209 } 210 } 211 else { 212 return EOK; 213 } 214 } 215 216 report_link = report_link->next; 217 } 218 219 return 1; 220 break; 221 /* the paths must be identical */ 192 222 case USB_HID_PATH_COMPARE_STRICT: 193 223 if(report_path->depth != path->depth){ 194 224 return 1; 195 225 } 196 226 227 /* path is prefix of the report_path */ 228 case USB_HID_PATH_COMPARE_BEGIN: 229 197 230 report_link = report_path->head.next; 198 231 path_link = path->head.next; … … 221 254 } 222 255 223 if(((report_link == &report_path->head) && (path_link == &path->head)) || 224 (((flags & USB_HID_PATH_COMPARE_COLLECTION_ONLY) != 0) && 225 (path_link = &path->head) && 226 (report_link == report_path->head.prev))) { 256 if((((flags & USB_HID_PATH_COMPARE_BEGIN) != 0) && (path_link == &path->head)) || 257 ((report_link == &report_path->head) && (path_link == &path->head))) { 227 258 return EOK; 228 259 } … … 232 263 break; 233 264 234 /* compare with only the end of path*/265 /* path is suffix of report_path */ 235 266 case USB_HID_PATH_COMPARE_END: 236 267 237 if((flags & USB_HID_PATH_COMPARE_COLLECTION_ONLY) != 0) { 238 report_link = report_path->head.prev->prev; 239 } 240 else { 241 report_link = report_path->head.prev; 242 } 268 report_link = report_path->head.prev; 243 269 path_link = path->head.prev; 244 270
Note:
See TracChangeset
for help on using the changeset viewer.