alternate methods of parallel port access
Well i'm having trouble using ioperm and outb for some reason, my code looks fine but it just doesnt work. I sorta lost my test circuit in the process so i'm interfacing it directly to an LCD HD44780 module, which i have coded already and it has worked under w32, now i'm working on porting this to linux and i'm basically stuck in the converting my OutPort function from windows to linux, i don't get the expected output.
Basically my PORT_init function is like this: Code:
int PORT_init(unsigned long nPort) Yet when i try to initialize my LCD using this i get no output using the same code that worked. I'm running this as root and get no seg faults. I was wondering if it might be easier to use /dev/lp0? since then i wouldnt have to hardcode the port addresses. I've been reading about this and it goes somewhat like this from what i've read: Code:
fd = open("/dev/lp0", O_RDRW | O_NDELAY); |
*bump*
still need a response, or some link. Been searching online and i only find the same damn guide everywhere that just says something about using open and then using fseek (no idea how to use that) to get to the place you want to go (maybe 0x378 in my case?) and then you use read() and write() to manipulate the parallel port, of course the guide barely talks about this. Upon searching i find this same guide at five million different sites, so i don't really get anywhere, maybe trying a more specific search. Anyway if someone could just give me a quick example (maybe just how to write/read a byte to the data lines on the parallel port, using open + read/write no ioperm) i'de be extremely grateful. Thanks. |
I honestly don't know if you can do what you want from user space.
I'm certain that you can do it from a kernel driver. This a book that tells you - in great detail - how: Linux Device Drivers, Third Edition O'Reilly, Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman http://www.bookpool.com/sm/0596005903 'Hope that helps .. PSM |
basically i only need to be able to send bytes through the parallel power which i believe can be done in user space. It's pretty simple, i'd be surprised if i cant access it without resorting to ioperm and stuff. All i have to do is send through the data lines a byte and through the status lines. not too complicated.
|
The programming is beyond me. I just do PHP not C or C++, but have you confirmed that your parallel port is actually working. Do you have any parallel hardware that you can test on (printer, scanner)?
I say that because I have a parallel scanner that is very picky about it's port. It will not work with my onboard parallel port, but does through a Netmos serial/parallel card. I needed to get a kernel patch to get that piece of hardware working properly, so that it correctly identified the parport. Once you know the port is working, then you can look further into whether your signals are being detected. |
Yeah it works. I'm mainly trying to port some old code i did for windows, in which it also worked. So unless for some reason it has broken on me recently, it should be working fine.
|
Quote:
I had a Joystick that worked in Windows but did not work in Linux. It took a lot or research and trial and error and eventually hacking of joystick module file to get that working. So confirm that your port works in Linux for something basic and then test your code on it. |
Quote:
|
can you post the output of "/sbin/lspci"?
|
Quote:
Code:
0000:00:00.0 Host bridge: nVidia Corporation nForce2 AGP (different version?) (rev c1) |
All times are GMT -5. The time now is 11:40 AM. |