USBLib_DevMgrFindFree (SWI &5635A) — Finds devices matching criteria in unclaimed device pool.
R0 | number to skip, or 0 to start search |
R1 | size of results |
R2 | Pointer to array of addresses of device filters to use, zero terminated |
R3 | Pointer to array of pointers |
R0 | update skip value |
R1 | |
R2 | |
R3 | |
R4 | number of items returned in r3 |
R5 | 0 => more devices 1 => finished |
This call can be used by drivers to find the "new device" message for a device, this can be considered a device handle for the purposes of device management as it is unlikely the driver needs to extract data from this structure.
Example 3.3. Using USBLib_DevMgrFindFree
An example of how to use USBLib_DevMgrFindFree.
REM dim an array of results DIM results% 8 REM a device filter structure DIM filter% usbmsg_device_filter_sizeof% REM the memory for the pointers to the filters DIM filters% 8 REM setup filter pointers filters%!0 = filter% filters%!4 = 0 REM setup our filter - the check fields should be non zero REM to cause the equivalent value to actually be considered. filter%?usbmsg_device_filter_check_interface_class% = 0 filter%?usbmsg_device_filter_check_interface_subclass% = 0 filter%?usbmsg_device_filter_check_interface_protocol% = 0 filter%?usbmsg_device_filter_check_vendor_id% = 1 filter%?usbmsg_device_filter_check_product_id% = 1 filter%!usbmsg_device_filter_interface_class% = 0 filter%!usbmsg_device_filter_interface_subclass% = 0 filter%!usbmsg_device_filter_interface_protocol% = 0 filter%!usbmsg_device_filter_vendor_id% = &4b4 filter%!usbmsg_device_filter_product_id% = &1002 skip% = 0 REPEAT SYS "USBLib_DevMgrFindFree", skip%, 1, filters%, results% TO skip%,,,,items%,finished% IF items% > 0 THEN PRINT "found new device message, at &";~results%!0 PROCshow_newdev(results%!0) ENDIF UNTIL finished% <> 0 |