Index: /trunk/mfiles/COM_OpenNXTEx.m
===================================================================
--- /trunk/mfiles/COM_OpenNXTEx.m	(revision 438)
+++ /trunk/mfiles/COM_OpenNXTEx.m	(revision 641)
@@ -314,15 +314,5 @@
     else % LINUX file handle version
 
-        NXTName = readFromIniFile( inisection, 'NXTName', inifilename );
-        if isempty( NXTName )
-            NXTMAC = readFromIniFile( inisection, 'NXTMAC', inifilename );
-        else
-            NXTMAC = BT_Linux_ResolveName( NXTName );
-        end;
-        if isempty( NXTMAC )
-            ComPort = readFromIniFile( inisection, 'SerialPort', inifilename);
-        else
-            ComPort = BT_Linux_BindPort( NXTMAC );
-        end;
+        ComPort = readFromIniFile( inisection, 'SerialPort', inifilename);
 
         % on linux, there is no baudrate etc to set, so we ignore these ini
@@ -365,12 +355,8 @@
         handle = fopen( ComPort, 'r+' );
         if handle == -1
-            % the creation of the device node after BindPort may take some time
-            pause( .5 );
-            handle = fopen( ComPort, 'r+' );
-        end;
-        if handle == -1
             error( 'MATLAB:RWTHMindstormsNXT:Bluetooth:couldNotOpenConnection', 'Could not open bluetooth connection using port %s.', ComPort );
         end;
-        % make sure device is in raw mode - if this fails, let's hope for the best
+        % Try to make sure serial port is in raw mode. This is just a safety measure
+        % and probably not needed if btconnect is used. However, it doesn't hurt.
         unix( [ 'stty -F ' ComPort ' sane raw -echo -iexten' ] );
     end
@@ -957,66 +943,4 @@
 
 
-%% --- FUNCTION BT_Linux_ResolveName
-function [ mac ] = BT_Linux_ResolveName( name )
-
-    [ s, r ] = unix( 'hcitool scan' );
-    if s
-        error( 'MATLAB:RWTHMindstormsNXT:Bluetooth:Linux:scanFailed', 'hcitool command failed. no bluetooth hardware/software installed?' );
-    end;
-    
-    scan_results = regexp( r, [ '^' 9 '(?<mac>\w\w:\w\w:\w\w:\w\w:\w\w:\w\w)' 9 '(?<name>.+)$' ], ...
-        'names', 'dotexceptnewline', 'lineanchors' );
-    
-    r = strcmp( name, { scan_results.name } );
-    if sum( r ) ~= 1
-        error( 'MATLAB:RWTHMindstormsNXT:Bluetooth:Linux:NxtNotFound', [ '"' name '" not found or not unique. Try specifying MAC address.' ] );
-    end;
-    mac = scan_results( r ).mac;
-
-end
-
-
-%% --- FUNCTION BT_Linux_BindPort
-function [ device ] = BT_Linux_BindPort( mac )
-
-    % get list of currently bound ports
-    [ s, r ] = unix( 'rfcomm' );
-    if s
-        error( 'MATLAB:RWTHMindstormsNXT:Bluetooth:Linux:RfCommFailed', 'rfcomm command failed (bluetooth tools not installed?)' );
-    end;
-
-    bound_ports = regexp( r, '^rfcomm(?<port>\d+): (?<mac>\w\w:\w\w:\w\w:\w\w:\w\w:\w\w)', ...
-        'names', 'dotexceptnewline', 'lineanchors' );
-
-    r = strcmp( mac, { bound_ports.mac } );
-
-    if sum( r ) > 0
-
-        % MAC address already bound to
-        port = bound_ports( find( r, 1 ) ).port;
-
-    else
-
-        % find first free port and bind to it
-        port = int2str( find( accumarray( reshape( str2double( { bound_ports.port } ) + 1, [], 1 ), 1 ) == 0, 1 ) - 1 );
-        if isempty( port )
-            port = int2str( max( str2double( { bound_ports.port } ) ) + 1 );
-        end;
-        if isempty( port )
-            port = '0';
-        end;
-
-        [ s, r ] = unix( [ 'sudo rfcomm -r bind ' port ' ' mac ] );
-        if s || numel( r )
-            error( 'MATLAB:RWTHMindstormsNXT:Bluetooth:Linux:sudoFailed', 'sudo rfcomm failed (rfcomm.conf or sudo not setup properly?)' );
-        end;
-
-    end;
-
-    device = [ '/dev/rfcomm' port ];
-
-end
-
-
 %% --- FUNCTION StartMotorControl
 function h_out = StartMotorControl(progname, h_in)
Index: /trunk/mfiles/COM_MakeBTConfigFile.m
===================================================================
--- /trunk/mfiles/COM_MakeBTConfigFile.m	(revision 414)
+++ /trunk/mfiles/COM_MakeBTConfigFile.m	(revision 641)
@@ -59,5 +59,5 @@
             prompt    = {'Filename:', 'SerialPort:', 'BaudRate:', 'DataBits:', 'SendPause:', 'ReceivePause:', 'Timeout:'};
         else
-            prompt    = {'Filename:', 'NXT Name:', 'or NXT MAC:', 'or SerialPort:', 'SendPause:', 'ReceivePause:', 'Timeout:'};
+            prompt    = {'Filename:', 'SerialPort:', 'SendPause:', 'ReceivePause:', 'Timeout:'};
         end;
         num_lines = 1;
@@ -68,5 +68,5 @@
             default_parameters = {'bluetooth.ini','COM3','9600', '8', '5', '30', '2'};
         else
-            default_parameters = {'bluetooth.ini','','', '/dev/rfcomm0', '5', '30', '2'};
+            default_parameters = {'bluetooth.ini', '/dev/rfcomm0', '5', '30', '2'};
         end;
 
@@ -79,12 +79,13 @@
                 baudrate     = str2double(my_parameters{3});
                 databits     = str2double(my_parameters{4});
+                sendpause    = str2double(my_parameters{5});
+                receivepause = str2double(my_parameters{6});
+                timeout      = str2double(my_parameters{7});
             else
-                name         = my_parameters{2};
-                mac          = my_parameters{3};
-                port         = my_parameters{4};
+                port         = my_parameters{2};
+                sendpause    = str2double(my_parameters{3});
+                receivepause = str2double(my_parameters{4});
+                timeout      = str2double(my_parameters{5});
             end;
-            sendpause    = str2double(my_parameters{5});
-            receivepause = str2double(my_parameters{6});
-            timeout      = str2double(my_parameters{7});
 
 
@@ -105,12 +106,8 @@
             fwrite(h_file, sprintf('\r\n'));
 
+            fwrite(h_file, sprintf('SerialPort=%s\r\n', port));
             if ispc
-               fwrite(h_file, sprintf('SerialPort=%s\r\n', port));
                fwrite(h_file, sprintf('BaudRate=%d\r\n',   baudrate));
                fwrite(h_file, sprintf('DataBits=%d\r\n',   databits));
-            else
-               fwrite(h_file, sprintf('NXTName=%s\r\n',    name));
-               fwrite(h_file, sprintf('NXTMAC=%s\r\n',     mac));
-               fwrite(h_file, sprintf('SerialPort=%s\r\n', port));
             end;
             fwrite(h_file, sprintf('\r\n'));
