Bugs item #3595718, was opened at 2012-12-13 16:25
Message generated for change (Comment added) made by karlec
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=106744&aid=3595718&group_id=6744

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: HAL
Group: None
Status: Open
Resolution: None
Priority: 1
Private: No
Submitted By: https://www.google.com/accounts ()
Assigned to: John Kasunich (jmkasunich)
Summary: Can't loadrt encoder component with 8 names

Initial Comment:
Using current master branch
Man page for encoder says it supports a maximum of 8 channels.
An error occurs when using loadrt to load the encoder hal component with 
exactly 8 names. Using 7 names or num_chan=8 works ok. See below for patch. It 
appears at_pid, encoder_ratio, pid, siggen, and sim_encoder may have the same 
problem, but I have not tested them.

Steps to reproduce -- 
$ halrun
loadrt encoder 
names=encoder.1,encoder.2,encoder.3,encoder.4,encoder.5,encoder.6,encoder.7,encoder.8
insmod: error inserting 
'/usr/realtime-2.6.32-122-rtai/modules/linuxcnc/encoder.ko': -1 Operation not 
permitted
<stdin>:1: exit value: 1
<stdin>:1: insmod failed, returned -1
See the output of 'dmesg' for more information.
quit
$ dmesg | grep ENCODER
[10316.169439] ENCODER: ERROR: invalid number of channels: 9

Patch follows:
--- a/src/hal/components/encoder.c
+++ b/src/hal/components/encoder.c
@@ -204,7 +204,7 @@ int rtapi_app_main(void)
     if(num_chan) {
         howmany = num_chan;
     } else {
-        for(i=0; names[i]; i++) {howmany = i+1;}
+        for(i=0; names[i]; i++) {howmany = i;}
     }
 
     /* test for number of channels */


----------------------------------------------------------------------

Comment By: Karl Cunningham (karlec)
Date: 2012-12-14 08:06

Message:
Sorry for the confusion with the Google login. It was an expedient because
I didn't have my Sourceforge password handy. You're right, it was a
realtime build. Sorry for not mentioning that.

Please ignore my patch. It worked for me, but doesn't address the root
problem. It appears the list of names[] isn't being terminated properly, so
the search for the last one goes past the end when there's 8 names in the
loadrt command. I delved into it a bit further but didn't make any headway.

I think giving more than 8 names results in an error in
RTAPI_MP_ARRAY_STRING (or thereabouts), because it's told to allow no more
than 8 names. Giving exactly 8 passes that test, but causes the problem
above when checking the list of names[].

Interestingly, other several other components I tried, like encoder_ratio,
work properly.

----------------------------------------------------------------------

Comment By: https://www.google.com/accounts ()
Date: 2012-12-13 20:10

Message:
Ah, I can reproduce this with a realtime build.  7 names works, 8 names
does not work.  num_chan=8 works.  Looks like a real bug.

----------------------------------------------------------------------

Comment By: https://www.google.com/accounts ()
Date: 2012-12-13 19:50

Message:
I can not reproduce this on v2.5_branch or master (sim on 12.04).  The
"steps to reproduce" in the bug report run fine here.

The error message you got, "Operation not permitted", makes me think you're
on a realtime machine, and maybe you forgot to run "sudo make setuid"? 
When I try 9 names or num_chan=9, the error I get is:

names=encoder.1,encoder.2,encoder.3,encoder.4,encoder.5,encoder.6,encoder.7,encoder.8,encoder.9:
can only take 8 arguments


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=106744&aid=3595718&group_id=6744

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to