Method: HardsploitAPI#connect
- Defined in:
- lib/HardsploitAPI/Core/HardsploitAPI_USB_COMMUNICATION.rb
#connect ⇒ Object
Connect board and get an instance to work with Return USB_STATE
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/HardsploitAPI/Core/HardsploitAPI_USB_COMMUNICATION.rb', line 21 def connect @usb = LIBUSB::Context.new @devices = @usb.devices(:idVendor => 0x0483, :idProduct => 0xFFFF) if @devices.size == 0 then @device = nil @dev = nil raise ERROR::HARDSPLOIT_NOT_FOUND else if @@id >= @devices.size then raise ERROR::HARDSPLOIT_NOT_FOUND else begin if @dev == nil then @dev = @devices[@@id].open if RUBY_PLATFORM=~/linux/i && @dev.kernel_driver_active?(0) @dev.detach_kernel_driver(0) end @dev.claim_interface(0) end self.startFPGA sleep(0.1) self.setStatutLed(led:USB_COMMAND::GREEN_LED,state:true); rescue raise ERROR::USB_ERROR end end end end |