Pokeys
Do you have libusb-dev installed?
> -I/usr/realtime-3.4-9-rtai-686-pae/include
You won't have this. Mint will be 4.14.nnn and you may not have the rtai realtime kernel at all.
What does uname -a tell you?
> -I/usr/realtime-3.4-9-rtai-686-pae/include
Again, this needs to match a folder that actually exists.
> -I/usr/include/i386-linux-gnu
You probably have a 64-bit kernel, so i386 is likely to be wrong
You might have more luck using
sudo halcompile --install pokeys.comp
That should sort out some (but not all) of the issues pointed to above (and will eliminate the need for the manual compilation stage)
You can then try adding in includes, compiler arguments and linker arguments in to the .comp file from the list above to try to make it work...
There are (at least) three things that are available in .comp that for some reason are not documented....
include - like a #include after the ;;, but puts the /#include statement at the top of the generated C file.
option extra_compile_args "some arguments";
option extra_link_args "some arguments";
Please Log in or Create an account to join the conversation.
> -I/usr/include/libusb-1.0
Do you have libusb-dev installed?
> -I/usr/realtime-3.4-9-rtai-686-pae/include
You won't have this. Mint will be 4.14.nnn and you may not have the rtai realtime kernel at all.
What does uname -a tell you?
> -I/usr/realtime-3.4-9-rtai-686-pae/include
Again, this needs to match a folder that actually exists.
> -I/usr/include/i386-linux-gnu
You probably have a 64-bit kernel, so i386 is likely to be wrong
You might have more luck using
sudo halcompile --install pokeys.comp
That should sort out some (but not all) of the issues pointed to above (and will eliminate the need for the manual compilation stage)
You can then try adding in includes, compiler arguments and linker arguments in to the .comp file from the list above to try to make it work...
There are (at least) three things that are available in .comp that for some reason are not documented....
include - like a #include after the ;;, but puts the /#include statement at the top of the generated C file.
option extra_compile_args "some arguments";
option extra_link_args "some arguments";
Thank you for your fast response!
I have installed libusb-1.0.
Uname -a says: Linux cnc 4.16.12-rt5-kona-rt #1 SMP PREEMPT RT Fri Jun 8 10:39:47 JST 2018 x86_64 x86_64 x86_64 GNU/Linux
"> -I/usr/realtime-3.4-9-rtai-686-pae/include"
I have this folder, is this the right one? /usr/src/linux-headers-4.16.12-rt5-kona-rt/include
"> -I/usr/include/i386-linux-gnu"
Maybe this is the right one? /usr/include/x86_64-linux-gnu
But what does this whole block of commands anyway? The halcompile command seem to have worked. I got a file called pokeys.c
Thank you for your help!
Please Log in or Create an account to join the conversation.
Am I right so far?
And in this compiling procedure some errors occur.
I tried this compiling command:
gcc -Wall -Os -g -I. -I/usr/include/libusb-1.0 -I/usr/include -L/usr/lib/ -L/usr/lib/arm-linux-gnueabihf/ -lPoKeys -lusb-1.0 -I/usr/src/linux-headers-4.16.12-rt5-kona-rt/include -I. -I/usr/src/linux-headers-4.16.12-rt5-kona-rt/include -I/usr/include/x86_64-linux-gnu -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -fno-math-errno -funsafe-math-optimizations -fno-rounding-math -fno-signaling-nans -fcx-limited-range -mhard-float -DRTAI=3 -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -Wframe-larger-than=2560 -URTAPI -U__MODULE__ -DULAPI -Os -o pokeys ./pokeys.c -Wl,-rpath,/lib -L/lib -llinuxcnchal
Most of them seem to be undefined variables in the code of pokeys.c
Where should they be defined? Is there a problem with the pokeys library?
Isn't there an easier way to get this stuff running?
Please Log in or Create an account to join the conversation.
I understand at the moment that the halcompile made a file called pokeys.c which has to be compiled again with the gcc command.
Am I right so far?
That is one option with halcompile.
linuxcnc.org/docs/2.7/html/hal/comp.html
Typically you use the --install option and halcompile does everything.
But, this is a HAL component that relies on an external library. That generally causes trouble and the original poster worked round that by using halcompile to preprocess and then compiling "by hand"
But, the set of compile options listed are likely to be very specific to the system that the original poster was compiling on.
Most of them seem to be undefined variables in the code of pokeys.c. Where should they be defined? Is there a problem with the pokeys library?
My suspicion is that the compiler isn't finding the pokeys library at all.
This is why I suggested trying to do the whole thing with halcompile (which should automatically get _most_ of the compiler options right) and add in the things that it needs, like the pokeys library.
Can you see the pokeys library in /usr/include? Does it contain definitions of the missing things?
As a first step try adding
include pokeys.h;
Then try
halcompile --compile pokeys.comp
Pokeys is not officially supported in LinuxCNC in any way. The strength of Open Source is that you can do almost anything. The weakness is that some of the things you can do are quite difficult.Isn't there an easier way to get this stuff running?
Please Log in or Create an account to join the conversation.
Then i added "include "PoKeysLib.h"" before the separator.
Then I tried it again:
cnc@cnc:~/projects$ sudo halcompile --compile pokeys.comp
pokeys.comp:15:1: Trying to find one of ";"
> component pokeys "PoKeys IO driver, by Mit Zot";
> ^
while parsing Declaration():
> include "PoKeysLib.h"
> ^
while parsing File():
> include "PoKeysLib.h"
> ^
and got a new file pokeys.c
I don't know what parsing in Linux means. Am I on the right way?
Please Log in or Create an account to join the conversation.
(as is documented in the halcompile documentation)
Please Log in or Create an account to join the conversation.
I tried it again.
cnc@cnc:~/projects$ sudo halcompile --compile pokeys.comp
gcc -Os -g -I. -I/build/linuxcnc-2.9.0~pre0.1350.gb0a0416d3/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -Wframe-larger-than=2560 -DSIM -fPIC -URTAPI -U__MODULE__ -DULAPI -Os -o pokeys /tmp/tmpUe9hf9/pokeys.c -Wl,-rpath,/lib -L/lib -llinuxcnchal
/tmp/ccOrG51x.o: In Funktion »user_mainloop«:
/tmp/tmpUe9hf9/pokeys.comp:28: Warnung: undefinierter Verweis auf »PK_ConnectToDeviceWSerial«
/tmp/tmpUe9hf9/pokeys.comp:32: Warnung: undefinierter Verweis auf »PK_DigitalIOGet«
/tmp/tmpUe9hf9/pokeys.comp:32: Warnung: undefinierter Verweis auf »PK_AnalogIOGet«
/tmp/tmpUe9hf9/pokeys.comp:38: Warnung: undefinierter Verweis auf »PK_DisconnectDevice«
collect2: error: ld returned 1 exit status
Makefile:2: recipe for target 'pokeys' failed
make: *** [pokeys] Error 1
This is all I get.
As far as I found out there must be a problem with the linking of the library.
But I don't know how to solve this.
Maybe someone has an Idea.
Thank you.
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
- Posts: 19196
- Thank you received: 6434
it can not have a dot in front of /
Please Log in or Create an account to join the conversation.
Anyway, I think I have a solution to your problem.
Edit the pokeys.comp file to look like this
pin out bit in-# [55];
pin out unsigned ain-# [3];
pin out bit err;
pin in unsigned devSerial;
pin out bit alive;
license "GPL";
option extra_link_args "-lPoKeys";
;;
#include <unistd.h> /* UNIX standard function definitions */
#include "PoKeysLib.h"
sPoKeysDevice * dev=0;
int i=0;
Note the new "option extra_link_args" line.
(and, to be clear, that's a minus and lower-case L)
Then you should be able to compile and install in one step:
sudo halcompile --install pokeys.comp
Please Log in or Create an account to join the conversation.
This driver uses the PoKeys driver from here . It scans at about 15hz, fast enough for UI keys and knobs. I had problems with hidcomp, taking too much resources on my rather slow computer i use for my mill, so I wrote that. With this, i dont get any significant slow down on performance and key presses get detected 100%.
It needs device serial pin to be set in HAL file with proper value.
Set your IO pin function with standard windows software that comes with the board.
1) Install dependencies
sudo apt-get install git build-essential libusb-1.0-0 libusb-1.0-0-dev
git clone https://bitbucket.org/mbosnak/pokeyslib.git
cd pokeyslib
sudo make -f Makefile.noqmake install
sudo halcompile --install pokeys.comp
Create a new file in the
/etc/udev/rules.d
90-usb-pokeys.rules
SUBSYSTEM=="usb", ATTRS{idVendor}=="1dc3", ATTRS{idProduct}=="1001", GROUP="plugdev", MODE="664"
udevadm control --reload-rules
And that is it, now you can include the driver in your hal file with:
loadusr pokeys
setp pokeys.0.devSerial 12345
Please Log in or Create an account to join the conversation.