[Rxtx] getPortIdentifiers(); returning null enumertion

Ed eddythejekyll at gmail.com
Mon Aug 14 11:55:17 MDT 2006


When I try to get the mode with int mode = pPort.getMode(); it returns 0
which isn't any of the valid modes. I tried setting it explicitely with
pPort.setMode(ParallelPort.LPT_MODE_XXX );and all failed with

gnu.io.UnsupportedCommOperationException: setLPRMode was unable to proced
the requested                   mode in nativeSetSerialPortParams
        at gnu.io.LPRPort.setLPRMode(Native Method)
        at gnu.io.LPRPort.setMode(LPRPort.java:87)

Except for LPT_MODE_ANY, but the getMode call still failed out with an
invalid state.

I'm wondering if it's because I don't have the line pulled high like you
said. This isn't a printer connected. It's a relay board with pins 2-9 tied
to data, and 18-25 to gnd. The rest are open. I looked at a DB25 pinout
diagram and I'm not sure which pin I need to tie high, and I looked through
the archives, but didn't find a reference to something definitive.

Can someone help me with which pin is the "online" pin as Trent mentioned?

DB25 spec has ( I hope this formats correctly in this email)
BUSY (11), SEL (13)  or INIT (16) are candidates, but I'm guessing. Any
clues?

 *25 Pin D-Sub Connector PinOut*  Pin # Pin Name Pin Description and
Function  1 /STROBE Strobe  2 D0 Data Bit 0  3 D1 Data Bit 1  4 D2 Data Bit
2  5 D3 Data Bit 3  6 D4 Data Bit 4  7 D5 Data Bit 5  8 D6 Data Bit 6
9 D7 Data
Bit 7  10 /ACK Acknowledge  11 BUSY Busy  12 PE Paper End  13 SEL Select  14
/AUTOFD Autofeed  15 /ERROR Error  16 /INIT Initialize  17 /SELIN Select In  18
GND Strobe Ground  19 GND Data bit 1 and 2 Ground  20 GND Data bit 3 and 4
Ground  21 GND Data bit 5 and 6 Ground  22 GND Data bit 7 and 8 Ground  23 GND
Busy and Fault Ground  24 GND Paper out, Select, and Acknowledge Ground  25 GND
AutoFeed, Select input and Initialize Ground

Thanks,

Ed

On 8/12/06, Trent Jarvi <tjarvi at qbang.org> wrote:
>
>
> Remember that the lp code expects a printer - or something like it.  There
> is a line that specifies the printer is online.  If you are doing hobby
> work, you will need to raise that line or loop it back to something that
> is raised.
>
> If you just try reading a port with no device connected and online, there
> will be an error while trying to read.  This should be addressed in the
> mail-list archives.
>
> On Sat, 12 Aug 2006, Ed wrote:
>
> > Trent,
> > Right after I sent the results indicated below I re-ran the app and it
> > apparently found the parallel port. The difference was that I set the
> > permissions to :
> > /dev:
> > wildcard lp*
> > crw-rw-rw-  1 root lp 6, 0 2005-02-25 23:43 lp0
> > crw-rw-rw-  1 root lp 6, 1 2005-02-25 23:43 lp1
> > crw-rw-rw-  1 root lp 6, 2 2005-02-25 23:43 lp2
> >
> > I'm still not sure how to interpret the dmesg and lsmod before. However
> I'm
> > thinking that since the user now has permission to access the lp* port,
> a
> > request to access it loaded the lp and parport modules automatically and
> > allowed me access. Here's the output of lsmod now:
> > ed at falcon:~/src/workspace/EASServer/src$ lsmod | grep lp
> > lp                      5540   0 (autoclean)
> > parport                21608   1 (autoclean) [parport_pc lp]
> >
> > and dmesg:
> > ed at falcon:~/src/workspace/EASServer/src$  dmesg | grep lp
> > On node 0 totalpages: 161776
> > lp0: using parport0 (polling).
> >
> > So I think I'm good, and ready to  move on the next steps.
> >
> > Thanks Trent!
> >
> > Ed
> >
> >
> > On 8/12/06, Ed <eddythejekyll at gmail.com> wrote:
> >>
> >>  Thanks for the reply Trent.
> >>
> >> I'm on a different system today but am trying your suggestons. This is
> a
> >> debian 3.1r2 system and I'm running jdk 1.5.0_04.
> >>
> >> Take a look below, but I think I have no parallel port support on this
> >> kernel, however I never get the "No such device or address" return from
> the
> >> cat call as you did so I'm not sure how to interpret the results.
> >>
> >> When I run the test program (PortChooser.java), the getPortIdentifiers
> >> call finds only a PORT_SERIAL, and not the PORT_PARALLEL however this
> is
> >> more than I found on the RedHat system. Incidently --disable-lockfiles
> has
> >> no effect.
> >>
> >> It looks as though there is no parallel support in this kernel:
> >> falcon:/home/ed/src/workspace/EASServer/src# dmesg | grep lp
> >> On node 0 totalpages: 161776
> >> falcon:/home/ed/src/workspace/EASServer/src# lsmod | grep lp
> >>
> >> I'm a little confused by the results when I cat to the lp0 device. It
> >> seems from the dmesg output that I don't have parallel printer support,
> but
> >> when I cat to the lp0 device, I get permission denied if I'm non-root
> user
> >> and input/output error if I'm root. Apparently this means I have the
> >> device,
> >> but no support in the kernel?
> >>
> >> ed at falcon:~/src/workspace/EASServer/src$ cat /dev/lp0
> >>
> >> cat: /dev/lp0: Permission denied
> >> ed at falcon:~/src/workspace/EASServer/src$ su
> >> Password:
> >> falcon:/home/ed/src/workspace/EASServer/src# cat /dev/lp0
> >> cat: /dev/lp0: Input/output error
> >>
> >> Here's my lp* device permissions.
> >>   /dev:
> >>   wildcard lp*
> >>   crw-rw----  1 root lp 6, 0 2005-02-25 23:43 lp0
> >>   crw-rw----  1 root lp 6, 1 2005-02-25 23:43 lp1
> >>   crw-rw----  1 root lp 6, 2 2005-02-25 23:43 lp2
> >>
> >> If I change it to
> >>   /dev:
> >>   wildcard lp*
> >>   crw-rw-rw-  1 root lp 6, 0 2005-02-25 23:43 lp0
> >>   crw-rw-rw-  1 root lp 6, 1 2005-02-25 23:43 lp1
> >>   crw-rw-rw-  1 root lp 6, 2 2005-02-25 23:43 lp2
> >>
> >> I get:
> >> falcon:/home/ed/src/workspace/EASServer/src# cat /dev/lp0
> >> cat: /dev/lp0: Input/output error
> >> falcon:/home/ed/src/workspace/EASServer/src# exit
> >> ed at falcon:~/src/workspace/EASServer/src$ cat /dev/lp0
> >> cat: /dev/lp0: Input/output error
> >> ed at falcon:~/src/workspace/EASServer/src$
> >>
> >> What do you think? Should I recompile the kernel or is it something
> else?
> >>
> >> By the way, I added the user ed to the lp and uucp groups on this
> system.
> >>
> >> Thanks again,
> >>
> >> Ed
> >>
> >> On 8/11/06, Trent Jarvi <tjarvi at qbang.org> wrote:
> >> >
> >> > On Fri, 11 Aug 2006, Ed wrote:
> >> >
> >> > > I'm trying to read and write a parallel port on a standard (Dell)
> pc
> >> > running
> >> > > RHES 4.0 and Jdk1.5.0_07, but I'm having trouble getting out of the
> >> > gates.
> >> > >
> >> > > I'm having problems getting rxtx to return a port enumeration from
> >> > > getPortIdentifiers. I'm using a file
> >> > > PortChooser.java as a test file to get things going. This is from
> the
> >> > Java
> >> > > CookBook 2nd edition (Chapter 12). The call
> >> > >
> >> > > // get list of ports available on this particular computer,
> >> > > // by calling static method in CommPortIdentifier.
> >> > > Enumeration pList = CommPortIdentifier.getPortIdentifiers();
> >> > >
> >> > > returns a null pList;
> >> > > I have compiled rxtx-2.1-7r2 with --disable-lockfiles. If I
> configure
> >> > and
> >> > > compile without --disable-lockfiles I get:
> >> > >
> >> > > Stable Library
> >> > > =========================================
> >> > > Native lib Version = RXTX-2.1-7
> >> > > Java lib Version   = RXTX-2.1-7
> >> > > check_group_uucp(): error testing lock file creation Error
> >> > > details:Permission deniedcheck_lock_status: No permission to create
> >> > lock
> >> > > file.
> >> > > please see: How can I use Lock Files with rxtx? in INSTALL
> >> > > check_group_uucp(): error testing lock file creation Error
> >> > > details:Permission deniedcheck_lock_status: No permission to create
> >> > lock
> >> > > file.
> >> > > please see: How can I use Lock Files with rxtx? in INSTALL
> >> > > ...
> >> > >
> >> > > When I compile with --disable-lockfiles the call to
> getPortIdentifiers
> >> >
> >> > > simply returns a null Enumeration.
> >> > >
> >> > > I've read the documention and threads about this issue and I feel
> like
> >> > I've
> >> > > tried everything, so at the moment I'm stumped.
> >> > >
> >> > > I can supply any further info that may help.
> >> > >
> >> > > Thanks in advance.
> >> > >
> >> > > Ed
> >> > >
> >> >
> >> > Hi Ed
> >> >
> >> > You may want to check the permissions of /dev/lp*.  Also make sure lp
> or
> >> > your kernel support for lp is loaded.  It should show up in dmesg and
> >> > lsmod.
> >> >
> >> > For my laptop with no printer port enabled in BIOS is see:
> >> >
> >> > lp: driver loaded but no devices found
> >> >
> >> > in desg |grep lp
> >> >
> >> > [<LAPPY - root>] $ ls -l /dev/lp*
> >> > crw-rw---- 1 root lp 6, 0 Aug 11 00:10 /dev/lp0
> >> > crw-rw---- 1 root lp 6, 1 Aug 11 00:10 /dev/lp1
> >> > crw-rw---- 1 root lp 6, 2 Aug 11 00:10 /dev/lp2
> >> > crw-rw---- 1 root lp 6, 3 Aug 11 00:10 /dev/lp3
> >> >
> >> > here root and group lp can read and write.  Normal users cannot.
> >> >
> >> > Try a simple read as a user:
> >> >
> >> > [jarvi at lappy src]$ cat /dev/lp0
> >> > cat: /dev/lp0: Permission denied
> >> >
> >> > Fix as root
> >> >
> >> > [<LAPPY - root>]  chmod 666 /dev/lp*
> >> > [<LAPPY - root>] $ ls -l /dev/lp*
> >> > crw-rw-rw- 1 root lp 6, 0 Aug 11 00:10 /dev/lp0
> >> > crw-rw-rw- 1 root lp 6, 1 Aug 11 00:10 /dev/lp1
> >> > crw-rw-rw- 1 root lp 6, 2 Aug 11 00:10 /dev/lp2
> >> > crw-rw-rw- 1 root lp 6, 3 Aug 11 00:10 /dev/lp3
> >> >
> >> > Now as user:
> >> >
> >> > [jarvi at lappy src]$ cat /dev/lp0
> >> > cat: /dev/lp0: No such device or address
> >> >
> >> > So this is saying there is no lp0 on my laptop.
> >> >
> >> > --
> >> > Trent Jarvi
> >> > tjarvi at qbang.org
> >> >
> >>
> >>
> >>
> >> --
> >>
> >> Ed
> >>
> >
> >
> >
> >
>



-- 
Ed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qbang.org/pipermail/rxtx/attachments/20060814/59164078/attachment-1085.htm>


More information about the Rxtx mailing list