Windowse XP: parallel port works under Linux but not under XP.
GeneralThis forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Windowse XP: parallel port works under Linux but not under XP.
Hi: I wrote a program for linux that drives the parallel port (hex 378). It works perfectly well. However, under XP, a little test program that writes the parallel port, in the same machine, written in Pascal, does not actually write it. The program consists of only one line: 'PORT[$378]:= $00;', so the probability of an error in the program is almost zero. In the BIOS setup menu, I have, in Advanced>Super I/O configuration>Parallel port address, three choices: Disabled, 378 and 278, of which I chose 378. Also, in the same submenu, Parallel port mode gives three choices: Normal, Bi-directional and ECP+EPP. I have tried the three of them but in vain.
True, in linux I used the instructions (C) setuid(0) and ioperm(0x378, 1, 1) while in Pascal I do not do anything like that. However, I think the O.S. should give me some error notification. But it doesn't. Could you tell how I cold solve this difficulty, without using another operating system?
I wrote a program for linux that drives the parallel port (hex 378). It works perfectly well. However, under XP, a little test program that writes the parallel port, in the same machine, written in Pascal, does not actually write it. The program consists of only one line: 'PORT[$378]:= $00;', so the probability of an error in the program is almost zero. In the BIOS setup menu, I have, in Advanced>Super I/O configuration>Parallel port address, three choices: Disabled, 378 and 278, of which I chose 378. Also, in the same submenu, Parallel port mode gives three choices: Normal, Bi-directional and ECP+EPP. I have tried the three of them but in vain.
of course, as you turned the wrong handles.
Quote:
Originally Posted by stf92
True, in linux I used the instructions (C) setuid(0) and ioperm(0x378, 1, 1) while in Pascal I do not do anything like that.
Now we're getting to the point. Both Windows and inux are operating systems that don't tolerate direct access to a certain piece of hardware unless explicitly granted. Your Linux program requests that privilege appropriately, your Windows program doesn't.
Quote:
Originally Posted by stf92
However, I think the O.S. should give me some error notification. But it doesn't.
Yea. Windows is notorious for trying to invent something that might satisfy the programmer. In this case, it probably pretends to have done the port I/O operation.
Quote:
Originally Posted by stf92
Could you tell how I cold solve this difficulty, without using another operating system?
As with Linux, a Windows program has to acquire the right to access a certain I/O port directly.
And how could I be granted access to the I/O space? In the Internet I learn about some Inpout32.dll for XP. It seems that it works transparently, as if the O.S. were MS-DOS. I'll try it and will post the results if it works. If not, I'll remove XP and install Win95 or DOS.
And how could I be granted access to the I/O space? In the Internet I learn about some Inpout32.dll for XP.
I used directio.dll in a project some years ago.
Quote:
Originally Posted by stf92
It seems that it works transparently, as if the O.S. were MS-DOS.
Yes and no. Yes means your application can indeed be given direct access to certain I/O addresses, and no, you have to ask for it first. IIRC, there's a function in directio.dll that you call and claim exclusive access to a range of I/O addresses, and on return, the OS says yes or no (of course, it still denies access to I/O addresses being used by drivers needed by the system itself, like HDD controller or things like that.
Thank you, sir. I'll try to get documentation on that directio.dll.
EDIT: I shall do it in Linux, given that I have already some experience driving the parallel port under that O.S. It is about programming the flash memory of a microcontroller device. Because the microcontroller firmware written by the programmer will later interact with a DOS-Windows program, it was more practical to do both things under the same O.S. But the successful programming of the part would be, in itself, a true achievement for me. So, more important than the operating system of choice, is I think, the fact that i have already solved the problegomena of interfacing with the parallel port in Linux.
If I wrote this post it is because I thought the thing would be easier.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.