ligō

Dependency Status Code Climate

Description

ligō is a ruby gem implementing the Android Open Accessory Protocol to interact with Android devices via USB.

Android-side application is needed to make some use of this project. A sample LigoTextDemo Android application is available for usage demonstration.

Features

Just USB I/O using the Android Open Accessory Protocol…

Examples

require 'ligo'

id = {
  manufacturer: 'Ligo',
  model:        'VirtualAccessory',
  description:  'PC acts as an accessory!',
  version:      '0.1',
  uri:          'http://blog.renaud.io',
  serial:       '3678000012345678'
}

Ligo::Logging.configure_logger_output('/tmp/ligo-sample.log')
ctx = Ligo::Context.new
acc = Ligo::Accessory.new(id)

# You could inspect the Android devices list
puts ctx.devices.inspect

# Take the first one
dev = ctx.devices.first

# Switch the Android device to accessory mode
success = dev.attach_accessory(acc)

# then operate on the device (you'll need some Android code for this!)
if success
  dev.process do |handle|
    # I/O
  end
end

Requirements

ligō will be nothing without the LIBUSB Ruby binding and the underlying libusb library.

At the time of writing, ligō focuses on the GNU/Linux operating system and YARV/MRI ruby. ligō has been developed and tested on Debian GNU/Linux with ruby 1.9.3p327 and 1.9.3p429.

ligō is useless without Android-side application. A sample LigoTextDemo Android application is available for usage demonstration.

Install

You may install ligō by using:

$ gem install ligo

Or, you can install it from the github repository:

$ git clone https://github.com/nibua-r/ligo.git
$ cd ligo
$ rake install

Pending tasks

  • Write the specs and automate testing!
  • ~~Provide an Android demo application~~ → See sample LigoTextDemo Android application, more to come soon…
  • Improve the documentation → in progress, a first pass has been made…
  • ~~Release and push the gem to rubygems.org~~
  • Finalize and publish a celluloid-based write-back usage sample (already working with the sample LigoTextDemo Android application and the libusb 0.3.0 gem async and polling APIs)
  • Create a wiki with FAQ, supported devices listing, UMS/accessory interactions, etc.

Contributing to ligō

  • Follow the usual fork/branch/PR workflow to send changes, if I like them I'll merge them
  • Help me to create a supported device listing

Copyright (c) 2012, 2013 Renaud AUBIN

See LICENSE for details.