Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

autodetect_nxt should now work with linux

  • Loading branch information...
commit 27eb46f3a0b4666200a27363245b6fc1574d7153 1 parent 6ef7f2e
Matt Zukowski authored February 08, 2009
5  ruby/lib/autodetect_nxt.rb
@@ -29,8 +29,11 @@
29 29
 	begin
30 30
 		devices = Dir["/dev/*NXT*"]
31 31
 		$DEV = devices[0] if devices.size > 0
  32
+		devices = Dir["/dev/rfcomm*"]
  33
+		$DEV = devices[0] if devices.size > 0
32 34
 		puts "Auto-detected NXT at #{$DEV}"
33 35
 	rescue
  36
+		$stderr.puts "WARNING: NXT could not be automatically detected!"
34 37
 		# the /dev directory probably doesn't exist... maybe we're on Win32?
35 38
 	end
36  
-end
  39
+end
17  ruby/lib/nxt_comm.rb
@@ -15,18 +15,23 @@
15 15
 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 16
 
17 17
 begin
18  
-  # Need to do a Kernel::require otherwise when included with rubygems, it fails
19  
-  Kernel::require "serialport"
20  
-  require "usb"
21  
-  #require "serialport"
22  
-rescue LoadError
  18
+  begin
  19
+    require "serialport"
  20
+    require "usb"
  21
+  rescue LoadError
  22
+    require "rubygems"
  23
+    require "serialport"
  24
+    require "usb"
  25
+  end
  26
+rescue LoadError => e
23 27
   puts
24 28
   puts "You must have the ruby-serialport and ruby-usb installed!"
25 29
   puts "You can download ruby-serialport from http://rubyforge.org/projects/ruby-serialport/"
26 30
   puts "You can download ruby-usb from http://www.a-k-r.org/ruby-usb/"
27 31
   puts "note: OSX currently requires latest ruby-usb development version from subversion"
28 32
   puts
29  
-  exit 1
  33
+  raise e
  34
+  #exit 1
30 35
 end
31 36
 require "thread"
32 37
 require "commands"

0 notes on commit 27eb46f

Please sign in to comment.
Something went wrong with that request. Please try again.