Class: USBUtils::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/usbutils/cli.rb

Instance Method Summary collapse

Instance Method Details

#devicesObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/usbutils/cli.rb', line 9

def devices
  devices = USBUtils.devices
  USBUtils.devices.each do |device|
    if options[:detail]
      pp device
    else
      print "serial=#{device[:serial]}\tproduct=#{device[:product]}\tmanufacturer=#{device[:manufacturer]}\tusbdev=#{device[:usbdev]}\n"
    end
  end
end

#reset(serial) ⇒ Object



21
22
23
24
# File 'lib/usbutils/cli.rb', line 21

def reset(serial)
  device = USBUtils.find_by(:serial, serial)
  device[:usbdev].open.reset_device
end