"X11 wrong authorisation protocol attempted" with opengl and sdl over ssh - opengl

I've followed a few tutorials on setting up Xming and putty, and also trying with cygwin but there is one particular C progam from a raspberry pi I'm having issues with over ssh to my windows machine. I've been somewhat successful as I can get Pygame and a few other small things to show up on my desktop. I'm now trying to do the same thing with the C program that uses SDL and OpenGL packages. When I try to run the program through ssh I get init_sdl() PuTTY X11 proxy: wrong authorisation protocol attempted
I also get the same error when trying to run it with MobaXterm.
at one point I did get init_sdl() without the error, but there should be two more lines that follow after that and then a GUI appear, and it isn't happening. So I think it's hanging on trying to initialize sdl? I'm not really sure. Are there any other resources I need for my windows side client?
If needed, here's the program I'm trying to run. It does work on the pi, just not over ssh. https://github.com/bear24rw/rgb_table/tree/master/code/table_drivers/beat_finder
Update: I can get init_sdl() to show every time now without the error following in cygwin, but still not getting a GUI to show or get the the full readout of
init_sdl()
init_gl()
init_fft()
init_serial() which is what should show.
EDIT2: There is a use_gui = TRUE/FALSE; option in the code, when I set this to false, I get init_fft() and init_serial() and the code works, but I would still like to have what's missing with SDL or GL to get the GUI part to work over SSH.

Related

QT Terminal Example not sending data

Qt "Terminal Example" is not working as expected with RS232.
I am using this as a boilerplate for my serial GUI application but cannot get it to send data to my device. Using the same settings in PUTTY I get a perfect output. I have narrowed it down to the issue that it will only send a single message and then no more. Is there some loop in there? I've already put debug statements all over to check unknown actions with no luck.
I checked what functions are outputting but I cannot see anywhere that it closes the port.
I also thought that maybe it was just me not sending the \r command but even this did nothing. I simply send the first message and then it does nothing.
I have tried sending it manually, with commands like these:
m_serial->write("command");
m_serial->write("command\r");
I have also tried following a solution here: How to make QSerialPort from Qt5.13.1 work?
I tried to update to the newest version and the maintenance tool did not find repository so I just did a clean install with 5.12.5 and same problem persists.
In my image, the first set of open-close is the terminal example. The second set is Putty working. I am definitely connecting because the error checking and serial port info I get from Qt is correct.
EDIT
My port settings are:
Baud: 9600
Data bits: 8
Stop Bits: 1
Parity: None
Flow Control: None
Qt Version: 5.13.1, 5.12.5

Possible to run glfw program on server's GPU over ssh?

I have a program that uses OpenGL+glsl to do computation. Currently I'm using GLFW to create a context in a hidden window via:
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
window = glfwCreateWindow(1, 1,"", NULL, NULL);
This is working great for me if I run my program locally on my server at work with a fancy GPU.
When I try to log on to this server from home via SSH, I get segmentation faults. I've tried ssh -X and ssh -Y but this doesn't help. I'm also not even sure that would run the program using the server's GPU (would it?).
All I'd like to do is run the program as if I was there at the keyboard issuing it on a local terminal. There's no window or graphics to forward. Is this possible?
Would this be easier with an alternative context manager to GLFW? I actually want to use OpenGL for my problem since it is trivially re-formulated as a direct rendering task (i.e., as opposed to rewriting my program in cuda).

How can freeglut probe whether or not an X11 server is available?

I have a program which can display data graphically using freeglut, which is nice but not essential. I use putty a lot to edit and compile my program on a debian server at home but when I try to run the binary from within putty I get this message:
freeglut (./a.out): failed to open display ''
Now I know that with a bit of fiddling about I could get cygwin to somehow tunnel the X server using ssh -X, but what I'd like is to simply detect if freeglut can render to the screen, and if it can't, simply to not bother.
How can I do this? I tried running a backtrace on my program in gdb but there's no stack, so I don't know if there's an exception or return value I can catch.
glutInit():
glutInit will initialize the GLUT library and negotiate a session with the window system. During this process, glutInit may cause the termination of the GLUT program with an error message to the user if GLUT cannot be properly initialized. Examples of this situation include the failure to connect to the window system, the lack of window system support for OpenGL, and invalid command line options.
So, no, you can't really handle a missing X server with GLUT. Short of some nasty hacks like a parent watchdog process or hooking exit() somehow.

libnodave communication with S7-1200

For a couple of days i've been trying to use libnodave as communication library to communicate with a S7-1200 PLC of Siemens(CPU 1214C).
With the libnodave library there are a couple of things provided.
The Delphi application is working, the windows executable is working.
On the Vmware I'm running Linux and the precompiled binary of testISO_TCP is working.
Seems like i can use it, right?
daveInterface * di;
daveConnection * dc;
_daveOSserialType fds;
ds.rfd=openSocket(102, "192.168.0.1");
fds.wfd=fds.rfd;
if (fds.rfd>0) {
di =daveNewInterface(fds,"IF1",0, daveProtoISOTCP, daveSpeed187k);
daveSetTimeout(di,5000000);
dc =daveNewConnection(di,0,0,1); // insert your rack and slot here
if (0==daveConnectPLC(dc))
{
printf("Connected..\n");
}
}
But when i copy the source code 1:1 to my IDE (Eclipse) i get the following error message:
IF1 error in daveConnectPLC() step 1. retrying...IF1 error in daveConnectPLC() step 1. retrying...IF1 error in daveConnectPLC() step 1. retrying...Couldn't connect to PLC.
Please make sure you use the -2 option with a CP243 but not with CPs 343 or 443.
Seems like there is some error when connecting to the PLC. The following function generates this error:
DaveConnectPLC(dc)
Note that the rack and slot are unchanged when you compare it to the executed binary in Linux!
Is someone able to help me to get it work on the Eclipse IDE? It's quite weird all the executables/binaries are working but when i want to execute it straight from IDE it's not.
Thanks in advance.
First fo all running on virtual is not the same as running on a real computer.
That it runs on Windows does not guarantee it runs under Linux despite the fact the source is the same and/or the same libraries are used.
Basically the precompiled program under Linux is the only proof that it will and can run.
Whenever I have issues in this area, I look with the compiler version used and compiler settings. Running code with debug option is notorious to corrupt code with hardware communication.
If you were not already using Wireshark, I would highlt recommend to use it. It is a perfect tool to see what's going on.

How to take screenshots on Raspberry Pi effectively?

I'm trying to take a screenshot of the screen in my C++ code. The code is executed in the terminal.
I only have few milliseconds to capture the screen so I would like to use a code that is possibly really fast.
So far I have tried:
System("import -window root screenshot.jpg");
but It fails stating that it doesn't recognize import.
I have also tried:
System("sudo scrot");
which fails as well with this error: "Can't open X display. It is running, yeah?"
Any ideas on how to take a screenshot of screen really fast?