|
From: <rob...@us...> - 2009-03-17 22:16:08
|
Revision: 12599
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=12599&view=rev
Author: rob_wheeler
Date: 2009-03-17 22:16:00 +0000 (Tue, 17 Mar 2009)
Log Message:
-----------
You must be root to run.
Modified Paths:
--------------
pkg/trunk/drivers/motor/ethercat_hardware/src/motorconf.cpp
pkg/trunk/robot_control_loops/pr2_etherCAT/src/main.cpp
Modified: pkg/trunk/drivers/motor/ethercat_hardware/src/motorconf.cpp
===================================================================
--- pkg/trunk/drivers/motor/ethercat_hardware/src/motorconf.cpp 2009-03-17 21:47:33 UTC (rev 12598)
+++ pkg/trunk/drivers/motor/ethercat_hardware/src/motorconf.cpp 2009-03-17 22:16:00 UTC (rev 12599)
@@ -64,7 +64,7 @@
// Initialize network interface
if ((ni = init_ec(interface)) == NULL)
{
- fprintf(stderr, "Unable to initialize interface: %s", interface);
+ fprintf(stderr, "Unable to initialize interface: %s\n", interface);
exit(-1);
}
@@ -73,14 +73,14 @@
EtherCAT_AL *al;
if ((al = EtherCAT_AL::instance()) == NULL)
{
- fprintf(stderr, "Unable to initialize Application Layer (AL): %p", al);
+ fprintf(stderr, "Unable to initialize Application Layer (AL): %p\n", al);
exit(-1);
}
uint32_t num_slaves = al->get_num_slaves();
if (num_slaves == 0)
{
- fprintf(stderr, "Unable to locate any slaves");
+ fprintf(stderr, "Unable to locate any slaves\n");
exit(-1);
}
@@ -238,10 +238,16 @@
int main(int argc, char *argv[])
{
+ // Must run as root
+ if (geteuid() != 0)
+ {
+ fprintf(stderr, "You must run as root!\n");
+ exit(-1);
+ }
+
// Keep the kernel from swapping us out
mlockall(MCL_CURRENT | MCL_FUTURE);
- //
// Parse options
g_options.program_name_ = argv[0];
g_options.device_ = -1;
@@ -297,7 +303,6 @@
string filename = "actuators.conf";
if (g_options.actuators_ != "")
filename = g_options.actuators_;
- printf("Filename: %s\nWith:%s\n",filename.c_str(), g_options.actuators_.c_str());
TiXmlDocument xml(filename);
if (xml.LoadFile())
Modified: pkg/trunk/robot_control_loops/pr2_etherCAT/src/main.cpp
===================================================================
--- pkg/trunk/robot_control_loops/pr2_etherCAT/src/main.cpp 2009-03-17 21:47:33 UTC (rev 12598)
+++ pkg/trunk/robot_control_loops/pr2_etherCAT/src/main.cpp 2009-03-17 22:16:00 UTC (rev 12599)
@@ -440,6 +440,13 @@
static pthread_attr_t controlThreadAttr;
int main(int argc, char *argv[])
{
+ // Must run as root
+ if (geteuid() != 0)
+ {
+ fprintf(stderr, "You must run as root!\n");
+ exit(-1);
+ }
+
// Keep the kernel from swapping us out
mlockall(MCL_CURRENT | MCL_FUTURE);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|