Method: HardsploitAPI#reconncet

Defined in:
lib/HardsploitAPI/Core/HardsploitAPI_USB_COMMUNICATION.rb

#reconncetObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/HardsploitAPI/Core/HardsploitAPI_USB_COMMUNICATION.rb', line 51

def reconncet
	@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
		begin
			@dev = @devices[@@id].open
			 if RUBY_PLATFORM=~/linux/i && @dev.kernel_driver_active?(0)
				@dev.detach_kernel_driver(0)
			 end
			@dev.claim_interface(0)
			self.startFPGA
			sleep(0.1)
			self.setStatutLed(led:USB_COMMAND::GREEN_LED,state:true);

		rescue
			raise ERROR::USB_ERROR
		end
	end
end