LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices

Reply
 
Search this Thread
Old 08-05-2013, 03:26 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,118

Rep: Reputation: 46
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?

Last edited by stf92; 08-05-2013 at 03:29 PM.
 
Old 08-05-2013, 04:02 PM   #2
Doc CPU
Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 999

Rep: Reputation: 294Reputation: 294Reputation: 294
Hi there,

Quote:
Originally Posted by stf92 View Post
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 View Post
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 View Post
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 View Post
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.

[X] Doc CPU
 
Old 08-05-2013, 04:26 PM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,118

Original Poster
Rep: Reputation: 46
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.
 
Old 08-06-2013, 11:34 AM   #4
Doc CPU
Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 999

Rep: Reputation: 294Reputation: 294Reputation: 294
Hi there,

Quote:
Originally Posted by stf92 View Post
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 View Post
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.

[X] Doc CPU
 
Old 08-06-2013, 01:47 PM   #5
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,118

Original Poster
Rep: Reputation: 46
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.

Last edited by stf92; 08-06-2013 at 03:34 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
parallel port in linux kernel tincy Linux - Newbie 8 10-05-2010 07:44 PM
Parallel port in linux? linuxunix Linux - Newbie 3 04-23-2010 10:05 PM
Writing to parallel port 0x37a works, 0x378 don't Pier Linux - Hardware 3 06-27-2006 04:51 PM
Parallel port interface on linux brave_heart7725 Linux - Hardware 8 05-28-2006 08:48 AM
Parallel port scanner works, almost. netcrawl Linux - Hardware 4 08-27-2004 05:46 PM


All times are GMT -5. The time now is 08:13 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration