USBLib_DevMgrFindFree (SWI &5635A)

USBLib_DevMgrFindFree (SWI &5635A) — Finds devices matching criteria in unclaimed device pool.

On Entry

R0number to skip, or 0 to start search
R1size of results
R2Pointer to array of addresses of device filters to use, zero terminated
R3Pointer to array of pointers

On Exit

R0update skip value
R1 
R2 
R3 
R4number of items returned in r3
R50 => more devices 1 => finished

Use

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
	

Related SWIs

USBLib_FindFreeDev (SWI &56354)

USBLib_DevMgrDrop (SWI &56357)

USBLib_DevMgrRelease (SWI &56358)

USBLib_DevMgrClaim (SWI &56359)

Related Information

usb_devmgr_drop

usb_devmgr_release

usb_devmgr_claim

usb_devmgr_find_free