3.5. Unclaimed Devices

3.5.1. Finding and using unclaimed devices

The unclaimed devices pool keeps device that where not claimed by any device driver, and can be accessed using a USB message to find and manage entries in it.

3.5.1. Finding and using unclaimed devices

The driver should create the relevant message, send it and inspect the results to see what is available. If the driver wants to use the device, it should first ensure it can claim it before attempting further communications. This will ensure nothing else on the system will interfere with the drivers use of the device.

As this operation is so common some support calls are provided to assist the driver writer in obtaining device messages from the unclaimed device pool. The unclaimed device pool can be searched using either usb_devmgr_find_free(USBLib_DevMgrFindFree (SWI &5635A)) or if only a single device is expected USBLib_FindFreeDev (SWI &56354) may be used. These calls all obtain the new device message associated with the device, this may be used to obtain any handles or references a driver requires.

Once a suitable device has been located it should be claimed from the unclaimed device pool with usb_devmgr_claim(USBLib_DevMgrClaim (SWI &56359)) which prevents other drivers from locating and hence using the device.