Ignore:
Timestamp:
Apr 21, 2017, 2:32:09 PM (2 years ago)
Author:
hectorgh
Message:

fixing udev rule

File:
1 edited

Legend:

Unmodified
Added
Removed
  • robolliurex/trunk/fuentes/src/robocore.cpp

    r89 r4393  
    77
    88#include <lsf-1.0/system.hpp>
     9#include <lsf-1.0/filesystem.hpp>
    910#include <gtk/gtk.h>
    1011
     
    8384
    8485RoboCore * RoboCore::singleton = nullptr;
    85 const char * RoboCore::comm_name[]={"/dev/ttyS0","/dev/ttyS1","usb"};
     86string RoboCore::comm_name[]={"/dev/ttyS0","/dev/ttyS1","usb"};
    8687
    8788RoboCore::RoboCore() : Application("net.lliurex.robolliurex")
     
    133134                cout<<"* Found Lego USB tower"<<endl;
    134135                comm_port = RBC_PORT_USB;
     136               
     137                vector<string> towers = filesystem::List("/dev/usb/legousbtower*");
     138               
     139                if(towers.size()==0)
     140                {
     141                        cout<<"* Warning, Lego driver is loaded but something failed!"<<endl;
     142                }
     143                else
     144                {
     145                        string usbp="usb:"+towers[0];
     146                        RoboCore::comm_name[comm_port]=usbp;
     147                        cout<<"Using tower device: "<<towers[0]<<endl;
     148                }
    135149               
    136150        }
     
    215229               
    216230        string cmd = string("nqc -S") + RoboCore::comm_name[RoboCore::GetCore()->comm_port] + " -firmware " + FIRM_PATH;
    217        
     231        cout<<cmd<<endl;
    218232        fp = popen( cmd.c_str(),"r" );
    219233       
     
    283297       
    284298        string cmd = string("nqc -S") + RoboCore::comm_name[RoboCore::GetCore()->comm_port] + " -raw 10";
    285        
     299        cout<<cmd<<endl;
    286300        fp = popen( cmd.c_str(),"r" );
    287301       
Note: See TracChangeset for help on using the changeset viewer.