isaac_toolbelt 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a3cd41e1f3660878d8bfe206f73372605af30c3
4
- data.tar.gz: 6d3800305608e29d31d7d8715f2cd2950cb441e3
3
+ metadata.gz: 01eeb3a9a2a8173a9059f47bd45c50d569f050c3
4
+ data.tar.gz: 6b66188c4c5d9c6f2c0ac090f91545435c5dae6b
5
5
  SHA512:
6
- metadata.gz: baf6d879abd057b1f05e0be8d273856bfba8038e0bfb6058aa8734c41a88ad5fb8437fd919ce30b565ce9958fb0456b050aa6a4a729e07934031fc93d373fc7e
7
- data.tar.gz: c527a6997f2ca7b8ed5f0535f27530cb1d999fcb672a6f7311c570cbe47fda4ddefe2a89aea7f5fcb473ba8c477c28549a2102a1e98ff67abb5021abde1eb832
6
+ metadata.gz: f2d8cedc9bf9bc326c196088e73e70d2018f987b5913b450802592d72feb9669e556e989bf438d750b806356ce638cd031105fa8c24d8b53d9bb0755daef63c5
7
+ data.tar.gz: be3a23b24ed7bc56b8cd6e2f816d49f2f95863b200df06f4fa67cfd0650a448447bda83fedfd3dffa0d940535c2071e65eede1216f5c43c17da2f12d747652be
@@ -436,6 +436,7 @@ module IsaacToolbelt
436
436
  end
437
437
 
438
438
  def dfu_download(usb_vid, usb_pid, alt_name, file_path, do_reboot=false)
439
+ retry_count = 0
439
440
  loop do
440
441
  params = %W(dfu-util -v -d #{usb_vid}:#{usb_pid} --alt #{alt_name} -D #{file_path})
441
442
  params << '-R' if do_reboot
@@ -446,8 +447,13 @@ module IsaacToolbelt
446
447
  puts "dfu-util exit with: #{status.to_i}"
447
448
  if status.to_i == 0
448
449
  break
450
+ elsif retry_count >= 10
451
+ STDERR.puts 'USB Error!!!'
452
+ STDERR.puts 'Please reboot your workstation, then try again.'
453
+ exit 1
449
454
  else
450
- sleep 1
455
+ retry_count += 1
456
+ sleep 0.1
451
457
  end
452
458
  end
453
459
  end
@@ -479,21 +485,21 @@ module IsaacToolbelt
479
485
  `dfu-util -l -d #{usb_vid}:#{usb_pid}`.split("\n").select{|l0|
480
486
  l0 =~ /Found/
481
487
  }.map {|str|
482
- ver = str.slice(/ver=.+?,/).chop.split('=')[1]
483
- devnum = str.slice(/devnum=.+?,/).chop.split('=')[1]
484
- cfg = str.slice(/cfg=.+?,/).chop.split('=')[1]
485
- intf = str.slice(/intf=.+?,/).chop.split('=')[1]
488
+ #ver = str.slice(/ver=.+?,/).chop.split('=')[1]
489
+ #devnum = str.slice(/devnum=.+?,/).chop.split('=')[1]
490
+ #cfg = str.slice(/cfg=.+?,/).chop.split('=')[1]
491
+ #intf = str.slice(/intf=.+?,/).chop.split('=')[1]
486
492
  alt = str.slice(/alt=.+?,/).chop.split('=')[1]
487
493
  name = str.slice(/name=.+?,/).gsub('"', '').chop.split('=')[1]
488
- serial = str.slice(/serial.+/).gsub('"', '').split('=')[1]
494
+ #serial = str.slice(/serial.+/).gsub('"', '').split('=')[1]
489
495
  {
490
- :ver => ver,
491
- :devnum => devnum,
492
- :cfg => cfg,
493
- :intf => intf,
496
+ #:ver => ver,
497
+ #:devnum => devnum,
498
+ #:cfg => cfg,
499
+ #:intf => intf,
494
500
  :alt => alt,
495
- :name => name,
496
- :serial => serial
501
+ :name => name
502
+ #:serial => serial
497
503
  }
498
504
  }
499
505
  end
@@ -1,3 +1,3 @@
1
1
  module IsaacToolbelt
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isaac_toolbelt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - xshell inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-14 00:00:00.000000000 Z
11
+ date: 2016-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler