lib/ligo/context.rb in ligo-0.1.0.beta vs lib/ligo/context.rb in ligo-0.1.0
- old
+ new
@@ -13,18 +13,24 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# TODO: Add a proper mention to libusb LGPL licensing since the following code
-# is a derivative work of Lars Kanis LIBUSB::Context.
-
module Ligo
+ # This class is a derivative work of `LIBUSB::Context` as included in
+ # [LIBUSB](https://github.com/larskanis/libusb), written by Lars Kanis and
+ # released under the LGPLv3.
+ # @author Renaud AUBIN
+ # @api public
class Context < LIBUSB::Context
include LIBUSB
+ # @api private
+ # Returns the list of AOAP-compatible devices
+ # @return [Array<Ligo::Device>] the list of AOAP-compatible devices
+ # currently connected on the USB bus.
def device_list
pppDevs = FFI::MemoryPointer.new :pointer
size = Call.libusb_get_device_list(@ctx, pppDevs)
ppDevs = pppDevs.read_pointer
pDevs = []
@@ -35,10 +41,10 @@
if VENDOR_IDS.include?(device.idVendor)
begin
# Include only AOAP compatible devices
pDevs << device if device.aoap?
rescue LIBUSB::ERROR_ACCESS
- # TODO: do something about this exception, log at least!
+ # @todo Do something about this exception, log at least!
end
end
end
Call.libusb_free_device_list(ppDevs, 1)
pDevs