Giter Club home page Giter Club logo

ligo's Introduction

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/r3n4ud/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

Copyright (c) 2012, 2013 Renaud AUBIN

See {file:LICENSE.txt} for details.

ligo's People

Contributors

r3n4ud avatar

Stargazers

 avatar  avatar Jeff Larkin avatar

Watchers

 avatar Leo Cacheux avatar

ligo's Issues

Fix `submit_transfer': error TRANSFER_STALL (LIBUSB::ERROR_PIPE) error on UMS Android devices

ligo-sample trace:

/home/renaud/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/libusb-0.2.2/lib/libusb/dev_handle.rb:432:in submit_transfer': error TRANSFER_STALL (LIBUSB::ERROR_PIPE) from /home/renaud/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/libusb-0.2.2/lib/libusb/dev_handle.rb:408:incontrol_transfer'
from /home/renaud/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/ligo-0.1.0/lib/ligo/device.rb:196:in block in get_protocol' from /home/renaud/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/libusb-0.2.2/lib/libusb/device.rb:62:inopen'
from /home/renaud/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/ligo-0.1.0/lib/ligo/device.rb:192:in get_protocol' from /home/renaud/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/ligo-0.1.0/lib/ligo/device.rb:167:inaoap?'
from /home/renaud/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/ligo-0.1.0/lib/ligo/context.rb:38:in block in device_list' from /home/renaud/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/ligo-0.1.0/lib/ligo/context.rb:31:intimes'
from /home/renaud/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/ligo-0.1.0/lib/ligo/context.rb:31:in device_list' from /home/renaud/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/libusb-0.2.2/lib/libusb/context.rb:179:indevices'
from /home/renaud/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/ligo-0.1.0/lib/ligo/device.rb:238:in wait_and_retrieve_by_serial' from /home/renaud/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/ligo-0.1.0/lib/ligo/device.rb:129:instart_accessory_mode'
from /home/renaud/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/ligo-0.1.0/lib/ligo/device.rb:102:in attach_accessory' from /home/renaud/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/ligo-0.1.0/bin/ligo-sample:21:in<top (required)>'
from /home/renaud/.rbenv/versions/1.9.3-p327/bin/ligo-sample:23:in load' from /home/renaud/.rbenv/versions/1.9.3-p327/bin/ligo-sample:23:in

'

Observed on HTC Flyer 3.2. To be tested on Nexus S with the latest factory rom.

The device has successfully switched to accessory mode…

get_protocol is called from https://github.com/nibua-r/ligo/blob/master/lib/ligo/device.rb#L238

Windows support

Due to non-standard USB behavior in Windows, the code need modifications to support that OS.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.