Sha256: 8360fdfe4f819b646efb2b42cc21cb9626178160023b45c92005a1bddd27708f

Contents?: true

Size: 1.64 KB

Versions: 5

Compression:

Stored size: 1.64 KB

Contents

require 'spec_helper'

# Assumption: two devices are connected on the usb bus and not yet in accessory
# mode. Those devices are a Galaxy Nexus running 4.2 AOSP and a HTC Flyer
# running 3.2 (with UMS support).

describe Ligo::Device do
  before(:all) do
    @default_accessory = Ligo::Accessory.new
    ctx = Ligo::Context.new
    @gnexus = ctx.devices(idVendor: 0x04e8).first
    @flyer  = ctx.devices(idVendor: 0x0bb4).first
  end

  it 'should derive from LIBUSB::Device' do
    Ligo::Device.superclass.should be LIBUSB::Device
  end

  context 'when passing the Galaxy Nexus to accessory mode' do
    specify { @gnexus.should_not be_accessory_mode }
    specify { @gnexus.idVendor.should  be 0x04e8 }
    specify { @gnexus.idProduct.should be 0x6860 }
    specify { @gnexus.should be_aoap }
    specify { @gnexus.should_not be_uas }
    specify { @gnexus.aoap_version.should be 2 }
    # Now, the order matters!
    specify { @gnexus.attach_accessory(@default_accessory).should be true }
    specify { @gnexus.idVendor.should be 0x18d1 }
    specify { Ligo::GOOGLE_PIDS.should include @gnexus.idProduct }
  end

  context 'when passing the Flyer to accessory mode' do
    specify { @flyer.should_not be_accessory_mode }
    specify { @flyer.idVendor.should  be 0x0bb4 }
    specify { @flyer.idProduct.should be 0x0ca9 }
    specify { @flyer.should be_aoap }
    specify { @flyer.should be_uas }
    specify { @flyer.aoap_version.should be 1 }
    # Now, the order matters!
    specify { @flyer.attach_accessory(@default_accessory).should be true }
    specify { @flyer.idVendor.should be 0x18d1 }
    specify { Ligo::GOOGLE_PIDS.should include @flyer.idProduct }
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ligo-0.2.0 spec/ligo/device_spec.rb
ligo-0.1.2 spec/ligo/device_spec.rb
ligo-0.1.1 spec/ligo/device_spec.rb
ligo-0.1.0 spec/ligo/device_spec.rb
ligo-0.1.0.beta spec/ligo/device_spec.rb