Find the answer to your Linux question:
Results 1 to 3 of 3
I have following code Code: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/io.h> #define base 0x378 /* printer port base address */ #define value 255 /* numeric value to send ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2011
    Posts
    2

    parallel port in Ubuntu


    I have following code
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <unistd.h>
    #include <sys/io.h>
    
    #define base 0x378           /* printer port base address */
    #define value 255            /* numeric value to send to printer port */
    
    int main(int argc, char **argv)
    {
       if (ioperm(base,1,1))
        fprintf(stderr, "Couldn't get the port at %x\n", base), exit(1);
    
       outb(value, base);
    
       return 0;
    }
    But at execution it give me following error at ioperm().
    Code:
    "Couldn't get the port at 378"
    Parallel port is seen at address 0x378 in proc/ioports.
    Do I need to run as root?

  2. #2
    Just Joined!
    Join Date
    May 2011
    Posts
    1

    Help with PCI Parallel port as simple digital output

    I have a question in the vein of this thread (w.r.t. to the question posed you need to be root or to make the executable owner root and set the sticky bit).

    My problem is:

    I have a Netmos PCI single parallel port card. It supposedly uses the NetMos 9805 chip, although Linux reports it as 9815 see lspci output below.

    What I want to do is set the parallel port up as output only and just use it as a simple Digital Out, i.e. I just want to be able to set the D0 to D7 High or Low and use this to control some simple external devices. This used to be doable with an ISA Parallel port card with the above code.

    I uses the same basic code as that given by the previous poster and run as root, it runs without reporting any errors but the output lines of the Parallel port card do not change state, they remain High (close to +5V). In addition to trying the 0x378 base address reported in dmesg, I also tried the I/O port base addresses below without success.

    I am using Ubuntu 10.04.1, kernel 2.6.32, x86_64. It has been tried in multiple machines (i7, i5, Atom) with the same OS and Kernel with the same result.

    Any suggestions greatly appreciated.



    03:00.0 Communication controller: NetMos Technology PCI 9815 Multi-I/O Controller (rev 01)
    Subsystem: LSI Logic / Symbios Logic Device 0020
    Flags: medium devsel, IRQ 19
    I/O ports at ec00 [size=8]
    I/O ports at e880 [size=8]
    I/O ports at e800 [size=8]
    I/O ports at e480 [size=8]
    I/O ports at e400 [size=8]
    I/O ports at e080 [size=16]
    Kernel driver in use: parport_pc
    Kernel modules: parport_pc

  3. #3
    Just Joined!
    Join Date
    May 2011
    Posts
    2
    Mine is fixed now. Compile and run as root. It's an onboard port.

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •