[Coco] CoCoNet

Gene Heskett gene.heskett at verizon.net
Sun Dec 28 01:44:39 EST 2008


On Saturday 27 December 2008, John Eric wrote:
>Which is exactly why I realized I wouldn't be able to do it myself, but it
> sure would be neat. The dmp-105 is supported by almost all CoCo programs,
> so I thought it would be a good one to emulate. It's sad that windows made
> printers ''dumb'' - the first inkjets that my uncle got back in the 90's
> would work with the coco, but later on, they starting depending upon
> windows and the pc's cpu to handle the nitty gritty and so could no longer
> be attached to the good old coco...
>
I solved that problem with a couple of scripts that run on this linux box, and 
a USB extension cable with a 4 port hub plugged into the far end.  I have 
purchased a Brother HL2140 laser, for about a 100 dollar bill.  I wrote a 
script that serves as a monitoring daemon, copying whatever is sent out of 
the bitbanger on the coco to a ser-usb adaptor, plugged into that hub.  As 
the coco can output at 9600 baud through /p when running nitros9, and the 
FDTI usb adapters are autospeed, so that data comes up here and is written to 
a file by cocod.  When a certain amount of time goes by with no new data, it 
assumes the coco's 'list filename >/p' operation is finished, closes the file 
and hands it off to another script that renders it through ghostscript and 
sends it back to the laser printer, also plugged into that same hub.  So I 
have a 20ppm B&W laser printer available for my beloved coco to use.  The 
scripts are attached, save them, make them executable, and put them into the 
rc.local on your linux box to exec them at boot time.  Put 'cocod' 
in /usr/local/libexec/cocod, it is the daemon, and put coco_print 
in /usr/local/libexec/coco_print.  They will keep the last 25 print jobs 
in /tmp/CoCo, and when those have been used up, will recycle the count.

The launching syntax in rc.local:

/usr/local/libexec/cocod </dev/usb/lp1 &

Change the 'lp1' to whatever the printer is on your system.  See the log 
looking for the usb discovery of the printer as the system boots.  Or you 
could use the same printer you use under linux as the default as setup in 
cups.conf.  /dev/usb/lp0 will usually get you that printer.

From dmesg (I have usb set to fairly noisy output), the printers discovery:
    4.662847] usb 1-10.3.4.1: new full speed USB device using ehci_hcd and 
address 12
[    4.755532] usb 1-10.3.4.1: configuration #1 chosen from 1 choice
[    4.758338] usb 1-10.3.4.1: New USB device found, idVendor=0403, 
idProduct=6001
[    4.758340] usb 1-10.3.4.1: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[    4.758342] usb 1-10.3.4.1: Product: USB HS SERIAL CONVERTER
[    4.758344] usb 1-10.3.4.1: Manufacturer: FTDI
[    4.758345] usb 1-10.3.4.1: SerialNumber: FTDHG43V
[    4.831906] usb 1-10.3.4.2: new full speed USB device using ehci_hcd and 
address 13
[    4.922839] usb 1-10.3.4.2: configuration #1 chosen from 1 choice
[    4.923161] usb 1-10.3.4.2: New USB device found, idVendor=04f9, 
idProduct=0033
[    4.923164] usb 1-10.3.4.2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[    4.923166] usb 1-10.3.4.2: Product: HL-2140 series
[    4.923168] usb 1-10.3.4.2: Manufacturer: Brother
[    4.923169] usb 1-10.3.4.2: SerialNumber: L7J156867
[...]
[   18.430476] usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 
0x04B8 pid 0x0005
[   18.430824] usblp1: USB Bidirectional printer dev 13 if 0 alt 0 proto 2 vid 
0x04F9 pid 0x0033
[   18.430860] usbcore: registered new interface driver usblp

I hope some of you find this helpfull.  There is always a way around dying 
coco compatible hardware, limited only by ones imagination, as Roger is so 
amply demonstrating here.

Happy New Year all!

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Remember: the biggest mistake to do is to overdesign. The road to hell is
paved with good intentions.

	- Linus on linux-kernel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cocod
Type: application/x-shellscript
Size: 3733 bytes
Desc: not available
URL: <http://five.pairlist.net/pipermail/coco/attachments/20081228/06a86784/attachment-0001.bin>
-------------- next part --------------
# child still has OutFile open as stdout, close it
exec 1>&-   # check syntax for closing a file descriptor

FileToPrint=${1:?need a file name}

if ! [[ -f $FileToPrint ]] || ! [[ -r $FileToPrint ]]
then
        # error handling for missing file
	echo No file to print, sorry. >&2
	exit
fi

# Now, if the printer is turned off, just let it be so its cached
# the system is nice enough to delete /dev/usb/lp1 when it no longer powered up
# Change below to match your setup.  One could also send it to lp0, my c82 with B&W profile

if [[ -e /dev/usb/lp1 ]]
then
	lp -d lp3 -o cpi=12 -o lpi=7 < $FileToPrint
else
#	echo using alternate printer lp0 >&2
#	lp -d lp0 -o cpi=12 -o lpi=7 < $FileToPrint

	echo The brother is turned off or disconnected - Saving file. >&2
fi
# If we don't do something with it, the drivers will nag you incessantly & must be killed



More information about the Coco mailing list