LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   PCMCIA 'port' not in /dev ? (https://www.linuxquestions.org/questions/slackware-14/pcmcia-port-not-in-dev-550260/)

bioe007 04-30-2007 07:52 PM

PCMCIA 'port' not in /dev ?
 
hi, i'm hoping someone might have some help here... i am desperately trying to figure out how to run my parallel port..

it is a PCMCIA parport, and does not show up in /dev/parport0

i need to link to the card from .wine to give parport access to programs.

googling turns up device linking for wine like this
Code:

ln -s /dev/parport $HOME/.wine/dosdevices/lpt1
and then adding reg key for the parport @378,278 etc...

but I have no /dev/parport.. so what do I link to?

/sys/bus/pcmcia/devices/0.0/ is another directory. not sure what to link to there.

the kernel pcmcia howto does not (to me) explain 'where' the device is actually mounted.. .
Code:

$ ls -l /sys/bus/pcmcia/devices/0.0/
total 0
--w------- 1 root root 4096 2007-04-30 09:24 allow_func_id_match
lrwxrwxrwx 1 root root    0 2007-04-30 17:10 bus -> ../../../../../bus/pcmcia/
-r--r--r-- 1 root root 4096 2007-04-30 17:10 card_id
-r--r--r-- 1 root root 4096 2007-04-30 17:10 func_id
-r--r--r-- 1 root root 4096 2007-04-30 17:10 function
-r--r--r-- 1 root root 4096 2007-04-30 17:10 manf_id
-r--r--r-- 1 root root 4096 2007-04-30 17:10 modalias
-rw-r--r-- 1 root root 4096 2007-04-30 17:10 pm_state
drwxr-xr-x 2 root root    0 2007-04-30 02:23 power/
-r--r--r-- 1 root root 4096 2007-04-30 17:10 prod_id1
-r--r--r-- 1 root root 4096 2007-04-30 17:10 prod_id2
-r--r--r-- 1 root root 4096 2007-04-30 17:10 prod_id3
-r--r--r-- 1 root root 4096 2007-04-30 17:10 prod_id4
lrwxrwxrwx 1 root root    0 2007-04-30 17:10 subsystem -> ../../../../../bus/pcmcia/
--w------- 1 root root 4096 2007-04-30 09:24 uevent

so I figure, well udev must be at work too, so tried man udev, vi rules.udev and man udevinfo...

i'm really getting nowhere. I know the card is detected:
Code:

$ /sbin/pccardctl ident
Socket 0:
  product info: "Quatech Inc", "PCMCIA Enhanced Parallel Port Card", "SPP-100", ""
  manfid: 0x0137, 0x0003
  function: 3 (parallel)

and supported...

I am up against a deadline which is fast approaching, please help! no idea will be refused :)

thanks.

bioe007 04-30-2007 11:53 PM

well, here i go talking to myself again..

more googling turned up a snippet about parport.opts for multiple cards, I don't have multiple cardss but here is my translation of that page:

Code:

  case "$ADDRESS" in
*,0,*)
    # Options for card in socket 0
    LINK=/dev/parport0
    # Options for 'tunelp'
    LP_OPTS=""
    # Card eject policy options
    NO_CHECK=n
    NO_FUSER=n
    ;;
esac

also had to recompile kernel to include parport, parport_pc (IBM style), parport_cs (cs=card services?) module support. those were listed as required. thats 'M' for ALL the parport options in 2.6.19.1, apparently the modular setup is required.

so dmesg seems to now also recognize the card, and I made a symbolic link to the pcmcia 'card':

Code:

# dmesg | grep parport
parport0: PC-style at 0x2100, irq 3 [PCSPP,TRISTATE,EPP]
# ls -l /dev/parp*
lrwxrwxrwx 1 root root 27 2007-04-30 21:41 /dev/parport0 -> /sys/bus/pcmcia/devices/0.0

It'd be great help if anyone has time to peruse the above and poke any holes in it they might find. I have only 1 parallel port peripheral which has to be run from either DOSEMU or WINE which really confounds the debugging process here..

pls remember I'm a n00b at this and any scrutiny is appreciated. I'll of course keep plugging at this and sorry if my rambling is wasting space/time on the continuum.. :D

bioe007 05-01-2007 09:42 AM

problem: now I reboot and my /dev/parport link is gone.. ghast! can anyone help me with where to config this to exist all the time?

tuxdev 05-01-2007 02:13 PM

It's a udev thing. The config file (IIRC) is at /etc/udev/rules.d/udev.rules or somesuch. Can't help you with the actual configuration changes, though.

bioe007 05-01-2007 03:05 PM

you are correct, and I've been reading through the man pages about this but I'm not sure how to translate my card to the parport0 device node.

I have since done more tweaking, and now my kernel added ppdev (under char devices) which if I modprobe ppdev gives me a /dev/parport0 but I think thats still incorrect, because its not pointing to the pcmcia card.

the udev.rules is confusing the hell out of me..

i can't get wine to work with the parport either...

it seems I'm doomed to windows..

bioe007 05-01-2007 06:47 PM

so in case anyone is still listening to me ramble..

Code:

cat /proc/ioports
<snip>
2000-2fff : PCI Bus #03
  2000-20ff : PCI CardBus #04
  2100-2107 : pcmcia_socket0
    2100-2102 : parport0
    2103-2107 : parport0
  2400-24ff : PCI CardBus #04
<snip>

so I am now trying to get this up and working in dosemu (1.3.4, with free-dos) and added the line:
Code:

$_ports = $_ports, "device /sys/bus/pcmcia/devices/0.0 fast range 0x378 0x37f" # lpt0
which doesn't work... i'm searching for dosemu.conf syntax now..

++tried this
Code:

$_ports = $_ports, "0x2100 fast range 0x378 0x37f" # lpt0
i get no detection from dosemu @ 0x378 though...

also of note, in windows the little light on my peripheral will glow red when plugged into the port, but now in linux it is not on... does this mean my port is not really 'on' or just that windows is sloppy about handing out power?

so now i'm trying to test from the linux side
Code:

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

#define base 0x378          /* printer port base address */
#define value 255            /* numeric value to send to printer port */

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);
}

old snippet of a progr I found, but evervalue I can think to try as base returns 'couldnt get the port'

bioe007 05-02-2007 02:28 AM

Solution
 
i've found the cure for the plague of the 21st century (windows... blech!)

well, perhaps thats overstating things just a little bit...

so to recap, my setup:

linux 2.6.19.1
slackware 11 (of course)
dosemu 1.3.5/freedos-1.0

dell latitude d820 (no parallel port)
quatech SPP-100 parallel port

needed these modules:
Code:

parport_cs              4224  1
parport_pc            36036  1 parport_cs
parport                32328  2 ppdev,parport_pc
ppdev                  7812  2

so the way the drivers work, please anyone correct me if I'm misrepresenting here, the parport is the top level driver and handles stuff to the kernel direct, parport_cs gets & passes information via parport_pc to create the pcmcia device. At this point one could use the address found by:

Code:

$ cat /proc/ioports
<snip>
2000-2fff : PCI Bus #05
  2000-20ff : PCI CardBus #06
  2100-2107 : pcmcia_socket0
    2100-2102 : parport0
    2103-2107 : parport0
  2400-24ff : PCI CardBus #06
<snip>
$

the address of our port being 0x2100, with a range to 0x2107 (I still havent come across why its split like that... but its late and I'm no longer thinking) <edit - i guess its an addr size v. pins?>

<edit forgot something-sorry 'tis late here>
so the scrupulous reader will note that the assignments changed between post #6 and this one. thats because of this bus path:
Quote:

Originally Posted by that url
lspci -v | grep subordinate

#Its result may be like this:

Bus: primary=00, secondary=02, subordinate=04, sec-latency=64
Bus: primary=02, secondary=03, subordinate=06, sec-latency=176
Bus: primary=02, secondary=07, subordinate=0a, sec-latency=176

so thats not exactly like mine was because mine is now and I'm not in the mood to reboot. i did this:
Code:

append="pci=assign-busses"
which resulted in this:
Code:

$ /sbin/lspci -v | grep subordinate
        Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
        Bus: primary=00, secondary=02, subordinate=02, sec-latency=0
        Bus: primary=00, secondary=03, subordinate=03, sec-latency=0
        Bus: primary=00, secondary=04, subordinate=04, sec-latency=0
        Bus: primary=00, secondary=05, subordinate=09, sec-latency=32
        Bus: primary=05, secondary=06, subordinate=09, sec-latency=176

which finally let me cpu talk with the cardbus. the basic idea is there must be direct path between 00 and 02 (i'm kind of guessing here) else we better create on at boot time. another way to check for this need was/is dmesg | grep assign. if you see the kernel recommending it, go for it..

but lets just say... hypothetically, you need to use dosemu to write to an eprom burner, or eprom emulator... ;)

enter ppdev... ppdev creates /dev/parport0 so that in /etc/dosemu.conf you can do this:
Code:

$_ports = $_ports, "  device /dev/parport0 range 0x2100 0x2107" # lpt0
and don't forget the space after "

now you just run dosemu and bin\rttest16.exe /P2100... oh, wait thats not related to this..

seriously I hope this helps some other troubled soul...


All times are GMT -5. The time now is 04:11 AM.