Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hello Everyone! can someone help me with this problem:

I Bought an usb-to-parallel port adapter (lsusb give me Bus 001 Device 002: ID 067b:2305 Prolific Technology, Inc. PL2305 Parallel Port), and Linux recognize it as /dev/usb/lp0

dmesg:
[ 35.125223] usblp0: USB Bidirectional printer dev 2 if 0 alt 1 prot +o 2 vid 0x067B pid 0x2305 [ 35.125307] usbcore: registered new interface driver usblp
now the problem: both the modules Device::ParallelPort::drv::parport and Device::ParallelPort::drv::linux that i tried in perl gave me this error for the first module:
Device::ParallelPort unabel to create driver parport (see Device::Para +llelPort::drv::auto for further information) - Failed to load partpor +t driver for /dev/usb/lp0 at (eval 1) line 3 at ./parportcontroller line 5
and this for the second:
Use of uninitialized value in subroutine entry at /usr/local/lib/perl/ +5.10.0/Device/ParallelPort/drv/linux.pm line 68.
I Tried to hard code in the second module the device character file at line 68
$this->{DATA}{BASE} = linux_opendev("/dev/usb/lp0");
but this didn't work, the result is that my script doesn't set or get any bit from the parallel port. Here is my code:
#!/usr/bin/perl -w use Device::ParallelPort; my $port = Device::ParallelPort->new('linux'); if($port){ print "Bit 0: ".$port->get_bit(1)."\n"; $port->set_bit(1, 0); print "Bit 0: ".$port->get_bit(1)."\n"; } else { die "Errore sul driver\n"; }
and this is the result:
Use of uninitialized value in subroutine entry at /usr/local/lib/perl/ +5.10.0/Device/ParallelPort/drv/linux.pm line 68. Bit 0: 1 Bit 0: 1
The Device::ParallelPort::drv::parport module give me the error above. Someone can help me? Thanks, and sorry for my bad english XD

In reply to use Perl With usblp Parallel Adapter by Morzilla

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-18 03:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found