Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Detecting Parallel Port hardware in Linux

Status
Not open for further replies.

001

Junior Member level 3
Junior Member level 3
Joined
Aug 31, 2004
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
288
Hello

I am new to using Redhat linux,(9.1). I was working on a project on accessing the parallel port, to light LEDS, I noticed that the parallel port and serial ports where not seen by the Hardware Browser. When i disabled the parallel port for my CMOS(BIOS) the leds still went on in linux. This is really strange as this same PC is a dual boot system with win 98. and the ports where actually disabled when checked on windows 98.

Can someone help explain this strange thing. what do i do to make linux see the ports. Please help my limited knowledge.
Do i need to install any driver, if yes where do i get it from.

thanks
001
 

The Linux kernel doesn't use the BIOS when it takes control of the system, so you can still use the hardware in Linux. Windows 98 uses the BIOS, that's why you can't see it when it is disable.
I don't know what the "Hardware Browser" is. It sounds like something in KDE or GNOME or something. That is probably just a front end to lower-level Linux hardware accounting.
What applications and hardware are you using specifically?
Check out these links:
https://www.tldp.org/HOWTO/Serial-HOWTO.html
https://people.redhat.com/twaugh/parport/html/parportguide.html
Hope this helps.
 

Thanks for that information. But how do i take control of the parallel port. I am actually trying to send bits to the parallel port. I noticed the leds i connected to the port actually light in an irregular pattern probably in response to some internal instruction on the kernel.

001
 

hello,

i had a similar problem in red hat, but i just went to the manufacturers website of my parallel port and downloaded some drivers. everthying works fine now.

good luck
 

Check the Linux I/O port Programming tutorial over here
http://www.faqs.org/docs/Linux-mini/IO-Port-Programming.html

check the follwoing code from the above page

Code:
/*
 * example.c: very simple example of port I/O
 *
 * This code does nothing useful, just a port write, a pause,
 * and a port read. Compile with `gcc -O2 -o example example.c',
 * and run as root with `./example'.
 */

#include <stdio.h>
#include <unistd.h>
#include <asm/io.h>

#define BASEPORT 0x378 /* lp1 */

int main()
{
  /* Get access to the ports */
  if (ioperm(BASEPORT, 3, 1)) {perror("ioperm"); exit(1);}
  
  /* Set the data signals (D0-7) of the port to all low (0) */
  outb(0, BASEPORT);
  
  /* Sleep for a while (100 ms) */
  usleep(100000);
  
  /* Read from the status port (BASE+1) and display the result */
  printf("status: %d\n", inb(BASEPORT + 1));

  /* We don't need the ports anymore */
  if (ioperm(BASEPORT, 3, 0)) {perror("ioperm"); exit(1);}

  exit(0);
}

Main things to remmber
1) Get access to the ports before accessing
3) release the permissions for i/o ports
3) Compile with -O2 option (gcc -O2 -o pptest pptest.c)


I have done some experiments follwing the same. it worked fine under redhat 7.2
The problem of your code can be
1) you might not have taken I/O permissions
2) you might not have compiled with -O2 option.


Cheers
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top