229N/A------------
229N/ABugid#: 5010373:
229N/ANeed libusb library implementation in s10 freeware gate
229N/A
229N/APlugin Notes:
229N/A---------------
229N/A
229N/A- Plugins implement the usb interfaces
229N/A For interfaces that are not supported return ENOTSUP
229N/A
229N/A- Implement bus / device support locally.
229N/A Wrapper is responsible for presenting a unified global view
229N/A
229N/A- There are two ways that interfaces can be handled.
229N/A Either use the same symbol names as the usb.h interfaces
229N/A or use a prefixed symbol
229N/A Eg. usb_init
229N/A ut_usb_init where the prefix is ut_
229N/A The prefix info is read by the wrapper using a libusb_prefix
229N/A symbol. This variable needs to be initialized by the plugin.
229N/A
229N/A- If prefixed symbol is not being used please use the
229N/A -B direct flag to ensure that symbol collision does not
229N/A take place. i.e usb_xx symbol of the plugin does not collide
229N/A with the usb_xx of the wrapper
229N/A
229N/A- All plugin errors are simply passed up by the wrapper to the app.
229N/A
229N/A- wrapper makes use of the following and these need to be implemented
229N/A by the plugins
229N/A - libusb_prefix
229N/A - libusb_version
229N/A - libusb_init
229N/A - libusb_fini
229N/A
229N/A libusb_prefix:
229N/A discussed earlier
229N/A
229N/A libusb_version:
229N/A will be a const char * and initialzied by the
229N/A plugin to following the ON library/module format of major
229N/A # / minor #. So we will start with 1.1. Note that this has
229N/A nothing to do with the libusb API version. The libusb
229N/A API being implemented will occur in only two places.
229N/A The version of the library will be reflected in the mapfiles
229N/A of the wrapper and the plugin libraries.
229N/A
229N/A - DESC string of the package for the plugin
229N/A - libusb-config file shipped with the wrapper
229N/A
229N/A Other than this the versioning of the wrapper and the packages
229N/A and the versioning of the plugins will following the ON model.
229N/A For minor changes to the interface 1.x -> 1.y. For interface
229N/A changes that are not backward compatible (eg libusb 1.0) the
229N/A versioning wil be changed to 2.x to reflect this.
229N/A
229N/A libusb_init:
229N/A Return values are as follows:
229N/A SUCCESS - 0
229N/A FAILURE - -1
229N/A PLUGIN_EXCLUSIVE -2
229N/A (Note: initial ARC case only specified the 0 and -1)
229N/A The plugin exclusive will need to be added as closed fast
229N/A track approved.
229N/A
229N/A PLUGIN_EXCLUSIVE is used to indicate to the wrapper that this
229N/A plugin desires exclusive use and no other bus support will be
229N/A visible to the application. This is a user settable feature
229N/A and plugins can return SUCCESS/PLUGIN_EXCLUSIVE depending
229N/A upon the environment.
229N/A
229N/A libusb_fini:
229N/A called by the wrapper when a plugin is unloaded.
229N/A wrapper will not check the return values for this
229N/A
229N/Awrapper notes:
229N/A----------------
229N/A
229N/Awrapper is responsibe for the following:
229N/A
229N/A - loading the plugins
229N/A - supporting alternate load dirs
229N/A - loading all the plugin symbols
229N/A - passing app calls to plugin calls.
229N/A
229N/AThe wrapper is also responsible for the following:
229N/A
229N/A - if multiple plugins are loaded and they are all active
229N/A then link up a busses pointer for each plugin to give the
229N/A app a unified view of the busses and the devices hanging off
229N/A of these busses.
229N/A This is done by the wrapper when the usb_find_busess is called
229N/A by the app and the wrapper makes successive find_busses calls
229N/A into each plugin
229N/A
229N/A - The wrapper needs to be able to map a function call to the
229N/A correct plugin. For this reason it maintains a list of
229N/A device handles for each plugin. When an app makes a call
229N/A and passes in the usb_dev_handle call the wrapper searches its
229N/A list of open device handles and finds the matching plugin to
229N/A use. For this reason add and delete of device handles is implemented
229N/A in the wrapper.
229N/A
229N/A - usb_strerror() - since we cannot tell which plugins error
229N/A should be returned. not good to return all so we keep track
229N/A of the last plugin that was called and return the strerror
229N/A for the plugin.