Project

usb-ruby

0.0
No release in over 3 years
usb-ruby provides idiomatic Ruby access to libusb 1.0 via FFI without native extensions.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

~> 1.0
 Project Readme

usb-ruby

usb-ruby is a Ruby FFI binding for libusb 1.0. It exposes the libusb API through the top-level USB module and does not require native extension compilation.

Installation

Add the gem to your Gemfile:

bundle add usb-ruby

Or install it directly:

gem install usb-ruby

Usage

require "usb"

USB::Context.open do |context|
  context.devices.each do |device|
    descriptor = device.device_descriptor
    puts format("%03d/%03d %04x:%04x",
                device.bus_number,
                device.device_address,
                descriptor.vendor_id,
                descriptor.product_id)
  end
end

Development

Run:

bundle install
bundle exec rspec
bundle exec rake install

Contributing

Bug reports and pull requests are welcome at https://github.com/ydah/usb.

License

The gem is available as open source under the terms of the MIT License.