Reputation: 590
As per the title, I want to control a parallel (LPT) port using C# in Ubuntu.
Are there any inbuilt libraries in Mono that will allow me to do this?
Can anyone give any code examples of making this work?
Upvotes: 0
Views: 980
Reputation: 590
While I acknowledge Jesper's contribution, I felt his answer was incomplete and the initial answer gave only references to Windows code as pointed out by Dai. Jesper's follow up comment regarding P/Invoke did lead me down a path to finding the answer.
I have documented my complete solution, including code samples here: http://www.iaincarlin.com/ylsned/controlling-the-parallel-port-using-ubuntu-mono-and-c/ however, in a nutshell:
My blog post above contains more details regarding the background to what I was doing. I could have used native C++ to do the same thing (in fact it would have been easier to port my existing Dos code over to Linux), but I wanted to experiment with Mono and this was a practical way to do so.
I need to acknowledge the post here: http://www.moythreads.com/wordpress/2008/02/04/pinvoke-how-to-call-c-from-c/ that provided the most helpful in getting this to work.
Upvotes: 0
Reputation: 3218
Guide with basics, and c# code for use of inpout driver and api: http://www.codeproject.com/KB/cs/csppleds.aspx
More general collection of links, both technical as well as software related to the parallel port: http://www.lvr.com/parport.htm
I spend quite some time researching this, and never found a native mono library. It's easier for Serial Ports btw.
Upvotes: 1