Thanks @BrianTee_Admin, v5.7.1 works with GPS on Linux (under Wine) now, I will try to come with proper fix later, once I figure out what is going oin.
Did you turn on broadcasts, or just set the address to 127.0.0.1 with the new setting Brian added?
Set address to 127.0.0.1 with new AgOG
It’s been a while since I tried AOG under native Mono, so I spent a bit of time tonight. It works better than I remembered, after I patched the source code a little bit. I hope to give Brian a pull request sometime soon. Basically there are quite a few hard-coded Windows directory separators which fail under Mono on Linux.
MS recommends against using hard-coded directory separators anyway. The solution is to use Path.DirectorySeparatorChar
from System.IO
, which is pretty easy to do. I’ll submit a pull request against 5.7.1 to do that soon.
So it works and can save and load fields, but not vehicles. Graphics seem fine, except the main GL window overlaps the buttons down the right-side of the window. I’ll look into that. AgIO also has some geometry issues too.
I’m pretty sure it still requires full OpenGL, though, so it may not run on a Pi, but would be interesting to try. I don’t have a Pi currently, but I do have some Orange Pi 5’s coming that I’ll try it on. They are only OpenGL ES.
@torriem
I myself experimented with Mono, I already sent one PR and planned to send more patches once this one is merged.
I have already prepared:
- patch fixing case sensitive names (has PR already)
- fix for directory separator (what you have done too)
- one more easy fix I dont remember now
- some ugly workarounds fixing crash with some gifs (just replacing gifs which do not crush under Mono)
- some not so nice fix for serial port
After I come home from my work I will push it to my branch so we can compare our works.
I did not touch anything related the graphics tho, so some buttons (especially buttons on the right part of the screen) are kind of broken.
Saving settings also does not work for me, because Mono uses multiple directories for that.
PS: And to my surprise Mono version runs on Raspberry Pi 4 very well (facing same issues like on AMD64). It runs much faster than Wine version (because of the instructions translation), but under Wine the graphics is not so much broken IMO.
I’m sure your patches are much more extensive than anything I’ve done. would love to give it a try. I did not realize Mono might still be a viable path to cross-platform compatibility. I’m sure there is a way to make the code work with both Windows and Mono, and solve the display and geometry problems.
On the Pi 4 were you using the accelerated graphics driver (enabled through raspi-config), or just the default libmesa software rendering? With enough CPU, software rendering should be enough.
Here is my branch. I will improve commits and messages before PR, some commits will not be part of PR at all - showing the branch just as it is for now.
Have you managed the compile it without fixing case sensitive names? What about serial port, does it work for you? I had to fix all these things. Also the app crashes when it tries to show some gifs, therefore I replaced them by other gifs from the project (one of the commits not for PR).
Do you think it is possible to fix the geometry problems? It works in Wine, so I think it needs to be fixed in Mono itself.
I have raspberry with Manjaro and glxinfo showed accelerated driver, not software. And I do not think it will fall back to llvmpipe or so when it finds that some OGL extensions are missing. But I will double check tomorrow.
I agree it probably does not fall back to llvmpipe. Rather you’d just get OpenGL errors and a crash I would think.
I compiled with Visual Studio, so Windows didn’t care about the file names. I didn’t think to check filename case for things like config files, however.
As for serial ports, I didn’t test AgIO much but it does list ports as /dev/tty* instead of COM1, so I assume .net handles that just fine. The text is white on white in the drop down boxes under mono, though.
I haven’t look at the geometry issues just yet. AgIO cuts off quite a but. I wonder if just having a resizeable window would help with that, rather than a fixed dialog box. There are various text color issues too that might be solvable.
Here’s a fix for the right-hand panel not showing in Mono. Not sure if this is a bug in Mono (likely). The problem is that somehow the initial position of panelRight is too far left. Perhaps mono resized the window on us earlier, or the maybe the size of window AOG.exe requested initially isn’t quite what the final result is. Either way, one fix is to insert this at line 793 of GUI.Designer.cs:
panelRight.Left = oglMain.Width + oglMain.Left + 7;
That will force the panel to be in the proper position. Of course we could ensure this only applies to mono with:
if (Type.GetType ("Mono.Runtime")) {
panelRight.Left = oglMain.Width + oglMain.Left + 7;
}
I’m sure there are lots of glitches. One is that the tractor gets stuck in one place on the field sometimes despite continuing to drive and do coverage. A dotted yellow line always points back to where the tractor is still stuck on the map.
Also there are quite a few widgets like drop-down boxes where the text color is set to ActiveCaptionText, which everywhere except Windows 10 refers to the Window Titlebar text color. On my computer that’s white, so text ends up white on white. I changed most instances of ActiveCaptionText to WindowText and that cures that.
Had a brief look at settings saving. Basically the call to config.SaveAs() doesn’t seem to do anything in Mono (although the source code shows that it should). I’ve done some syscall tracing and nothing hits the file system anyway. I can’t quite figure out how to run a debugger and trace into the mono implementation of the class library. But many thanks for instructions on building on Linux in your branch. A real time saver! VS is verys low in my virtual machine.
That is great! I will try your fix for graphics.
As for serial port, Mono can see the serial ports, but can’t read them. There are some links in my commit, where some people recommend to use the other way to read from serial port (which also works with Mono), but I am not an expert.
I took basically the readme from @ptd006 (his branch) , who tried AOG in Mono some time ago - I also used Path.Combine based on the discussion here, but its already 3 years old. On the other hand, I did not need to fix that alpha channel for pngs.
The settings is a bit problem also for me, I read somewhere that Mono (on Linux?) has more paths where it look for settings directories, which causes a problem, but I am not sure.
I havent seen the glitch with the tractor not moving yet, interesting…
Seems like the default path for Mono to put configuration xml files is in $HOME/.local/share. And indeed AOG and AgIO do put files there, but they don’t seem to get updated when you quit. The fact that settings aren’t getting saved is a show stopper for sure. Problem seems to be in Mono. Serial port access is a show stopper too I’d think.
The problem with Mono is is it is incomplete and frozen in time. Microsoft owns Mono now, but I’m not sure it’s being maintained. And it’s certainly not going to receive any further development, as MS is focused on .net Core. Fortunately AOG still targets .net 4.5, so it may still be viable if these show stoppers can be worked out within the limitations of Mono, and without hurting things on Windows.
I need to figure out how to get a debugger running, and see if I can trace into the Mono runtime classes and see why it’s not actually writing to disk.
Hi all,
I have nothing constructive to add but just wanted to say it’s great to see progress!
Happy 2023,
Peter
I do enjoy working on little puzzles like this. I am too ADD to be a great coder like Brian and others are.
Hi
I have been trying wine32 on debian 12 with dotnet4.8 installed via winetricks
AgOpenGPS fails with this message
MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete
00e0:err:ole:CoGetContextToken apartment not initialised
0024:err:eventlog:ReportEventW L"Application: AgOpenGPS.exe\nFramework Version: v4.0.30319\nDescription: The process was terminated due to an unhandled exception.\nException Info: System.ArgumentException\n at System.Drawing.FontFamily.GetGdipGenericSansSerif()\n at System.Drawing.FontFamily.CreateFontFamily(System.S"…
Unhandled Exception: System.ArgumentException: Font ‘?’ cannot be found.
at System.Drawing.FontFamily.GetGdipGenericSansSerif()
at System.Drawing.FontFamily.CreateFontFamily(String name, FontColl
the error messages goes on for a while, I could paste the whole thing in if its useful.
At first glance to my untrained eye it looks like something to do with opengl or missing fonts ?
any ideas?
Do you know what version of wine it is?
Possibly the MS core fonts package might fix the fonts messages. https://www.linuxcapable.com/how-to-install-microsoft-fonts-on-debian-linux/
Has anyone else had this problem? I am running AOG with wine and everything work’s except for the WAS reading which appears to be stuck at 0. Is there a solution for this?
With ethernet or USB Serial?
That is with ethernet. Not really to sure what was going on but it seems like pretty much everything else seemed to work.
That is odd. AgIO is getting all the other data except WAS?
It appears so. The udp monitor even seemed to show PGN’s being sent and received but I will check to see which ones. I am going to have to take a closer look tonight.