# rastertokm2430dl filter with cups broken?



## saige (Jun 28, 2010)

Is anyone able to successfully run the rastertokm2430dl filter (for Konica-Minolta 2430DL printer) with cups?

I have been sincerely trying to get this to work for months, but no success.

I just fresh-installed 8.1RC1 (last week I was running 8.0-RELEASE) on amd64 hardware. The printer is a node on the network. When I try to print a test page from the cups control panel (http://localhost:631), I get this error message: 
	
	



```
stopped /usr/local/libexec/cups/filter/rastertokm2430dl failed
```

Is there a way that I can manually enter commands in the shell to accomplish the same thing as printing the test page from the cups control panel? Then maybe I could watch more closely what is happening for a clue.


----------



## wblock@ (Jun 28, 2010)

saige said:
			
		

> Is anyone able to successfully run the rastertokm2430dl filter (for Konica-Minolta 2430DL printer) with cups?
> 
> I have been sincerely trying to get this to work for months, but no success.
> 
> ...



Silly question, but is the print/cups-magicolor port installed?

Likely you could feed PS input to gs, output it with the cups driver, and pipe that into the rastertokm2430dl filter.  But I don't know the specifics of the filter.


----------



## saige (Jun 29, 2010)

Yes, print/cups-magicolor is installed... Here are my cups-related ports currently installed:


```
freebsd-desktop# pkg_info | grep cups
cups-base-1.4.3     Common UNIX Printing System: Server
cups-client-1.4.3   Common UNIX Printing System: Library cups
cups-image-1.4.3    Common UNIX Printing System: Library cupsimage
cups-magicolor-1.5.0_6 CUPS support for the Konica-Minolta Magicolor 2430DL
cups-pstoraster-8.15.4_6 Postscript interpreter for CUPS printing to non-PS printers
```

Is there a way I can manually run the cups printing process so I can see what is happening?


----------



## wblock@ (Jun 29, 2010)

saige said:
			
		

> Is there a way I can manually run the cups printing process so I can see what is happening?



The first part is easy (I think):
`# cat mypsfile.ps | gs -dSAFER -dNOPAUSE -q -sDEVICE=cups -sOutputFile=- -`

(Not a UUOC, that's so you can strip the rest of the line into a filter.)

After that, it gets murkier:
`# | rastertokm2430dl job-id user title copies options [file]`

rastertokm2430dl will probably need a full path.  If there's a man page or even a trivial doc for it at all, I missed it.

Running rastertokm2430dl without parameters is where I got the parameters.  job-id, user, title, and copies are probably all easy enough to set.  options seems to be optional, and it looks like it sets jpeg options.  Have to hope it will take stdin for input if no  is given.

Oh, and it seems to want environment variables DEVICEURI and PPD.  Fun!


----------



## saige (Jun 29, 2010)

Does this mean that the problem is with my copy of GhostScript?


```
$ cat test.ps | gs -dSAFER -dNOPAUSE -q -sDEVICE=cups -sOutputFile=-
Unknown device: cups
Unrecoverable error: undefined in .uninstallpagedevice
Operand stack:
    defaultdevice
```


----------



## saige (Jun 29, 2010)

Ok, I'm sort of replying to my own post...

So I figured that it might be possible that the GhostScript which originally installed on my system might _not_ be configured to support cups. So I re-built GhostScript:


```
cd /usr/ports/print/ghostscript8
make config  (turned on the "cups" support checkbox)
make install clean  (ran, then stopped because GhostScript already installed
make deinstall reinstall
```

Then I tried wblock's suggestion to see if cups executes properly. Well, at least it did not end with a complaint about "cups" as before. Now I get lots of lines of output that ends with:


```
...
Dictionary stack:
   --dict:1155/1684(ro)(G)--   --dict:2/20(G)--   --dict:115/200(L)--
Current allocation mode is local
Current file position is 3
GS<3>Error: /undefined in #t*
Operand stack:
   --nostringval--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   
%loop_continue   --nostringval--   --nostringval--   false   1   %stopped_push   .runexec2   --nostringval--   --nostringval--   --nostringval-
-   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1155/1684(ro)(G)--   --dict:2/20(G)--   --dict:115/200(L)--
Current allocation mode is local
Current file position is 5
GS<1>Error: /undefined in `
Operand stack:
   --nostringval--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   
%loop_continue   --nostringval--   --nostringval--   false   1   %stopped_push   .runexec2   --nostringval--   --nostringval--   --nostringval-
-   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1155/1684(ro)(G)--   --dict:2/20(G)--   --dict:115/200(L)--
Current allocation mode is local
Current file position is 2
GS<1>DEBUG2: cups_close(0x803abe060)
```

But still, when I try to print from cups' web-interface, it ends in failure:



> stopped
> "/usr/local/libexec/cups/filter/rastertokm2430dl failed"


----------



## wblock@ (Jun 29, 2010)

saige said:
			
		

> Ok, I'm sort of replying to my own post...
> 
> So I figured that it might be possible that the GhostScript which originally installed on my system might _not_ be configured to support cups. So I re-built GhostScript:
> 
> ...



Do the clean before rebuilding, because leftover builds can fool make into thinking there's no need to recompile:
`# make clean deinstall install`



> ```
> GS<3>Error: /undefined in #t*
> ```



Are you sure that's a PostScript file?  Here's one to try:
`# printf "%%\!PS\n/Helvetica findfont 24 scalefont setfont 72 72 moveto (PostScript tested.) show showpage"`


----------



## saige (Jul 2, 2010)

Thank you, wblock, for that bit of ps code.

I have tried a few things, but so far I am NOT able to get anything out of the printer. Using your code, here is what I tried... What is wrong with this invocation?


```
$ echo "%%\!PS\n/Helvetica findfont 24 scalefont setfont 72 72 moveto (PostScript tested.) show showpage" | \
/usr/local/libexec/cups/filter/pstops 1 saigel test 1 - | /usr/local/libexec/cups/filter/pstoraster | \
/usr/local/libexec/cups/filter/rastertokm2430dl 1 saigel test 1 -
```

Maybe I should back up for a minute and describe why I am doing this... I have performed a totally fresh, clean installation of FreeBSD 8.1-RC1. I manually installed the cups driver for the km2430dl, and these cups-related ports are installed:


```
$ pkg_info | grep cups
cups-base-1.4.3     Common UNIX Printing System: Server
cups-client-1.4.3   Common UNIX Printing System: Library cups
cups-image-1.4.3    Common UNIX Printing System: Library cupsimage
cups-magicolor-1.5.0_6 CUPS support for the Konica-Minolta Magicolor 2430DL
cups-pstoraster-8.15.4_6 Postscript interpreter for CUPS printing to non-PS printers
```

I use my browser to load the cups configuration page at http://localhost:631, and click on Administration, Manage Printers, and my Konica-Minolta is the only printer in the list of installed printers. I click on the link to the printer, click Maintenance, Print Test Page.

Then in the jobs list, it reports the printer state as:


```
processing since
Fri Jul 2 10:24:18 2010 
"/usr/local/libexec/cups/filter/rastertokm2430dl failed"
```

for a brief moment. Then the message changes to:


```
stopped 
"/usr/local/libexec/cups/filter/rastertokm2430dl failed"
```

Not sure what I am doing wrong.


----------



## roddierod (Jul 2, 2010)

Not sure if this will help as it from 5 years ago but here are some of issues and what I did to get it resolved, http://forums.bsdnexus.com/viewtopic.php?id=344


----------



## wblock@ (Jul 2, 2010)

saige said:
			
		

> Thank you, wblock, for that bit of ps code.
> 
> I have tried a few things, but so far I am NOT able to get anything out of the printer. Using your code, here is what I tried... What is wrong with this invocation?
> 
> ...



Don't know if any of the parameters are wrong, or maybe my semi-donkeyed temporary CUPS setup, but with that command line, the rastertokm2430dl filter core dumps on my system; does yours?  That would explain the "failed" message.

Probably worth contacting the port maintainer at this point.


----------



## saige (Jul 2, 2010)

Further looking into the error_log file, I see these lines:


```
...
D [02/Jul/2010:12:00:07 -0700] [Job 5] Ready to print.
D [02/Jul/2010:12:00:07 -0700] [Job 5] End of messages
D [02/Jul/2010:12:00:07 -0700] [Job 5] printer-state=3(idle)
D [02/Jul/2010:12:00:07 -0700] [Job 5] printer-state-message="Ready to print."
D [02/Jul/2010:12:00:07 -0700] [Job 5] printer-state-reasons=toner-empty-warning
E [02/Jul/2010:12:01:19 -0700] PID 10870 (/usr/local/libexec/cups/filter/rastertokm2430dl) crashed on signal 10!
E [02/Jul/2010:12:01:19 -0700] PID 10867 (/usr/local/libexec/cups/filter/bannertops) crashed on signal 13!
E [02/Jul/2010:12:01:19 -0700] PID 10868 (/usr/local/libexec/cups/filter/pstops) crashed on signal 13!
E [02/Jul/2010:12:01:24 -0700] [Job 5] Job stopped due to filter errors; please consult the error_log file for details.
```

In particular, I am interested to see that rastertokm2430dl crashed on signal 10--which I believe is a "bus error". In my experience, a "bus error" usually indicates bad memory chips or memory that is not fast enough for the CPU. Could it indicate something else? I don't think other programs are crashing on signal 10 on my system.

By the way, the "toner-empty-warning" should be advisory only, I hope. Because there is toner in the printer, and my Windows system prints on it just fine.

Frustrated!


----------



## wblock@ (Jul 2, 2010)

saige said:
			
		

> In particular, I am interested to see that rastertokm2430dl crashed on signal 10--which I believe is a "bus error".



But what does the command line version do on your system?  You can also break up those commands between the pipes and just save the output to temporary files.  That would let you test each step.


----------



## wblock@ (Jul 3, 2010)

Just noticed that my printf was changed to echo.  It should be printf, they aren't interchangeable:

```
$ printf "%%\!PS\n/Helvetica findfont 24 scalefont setfont 72 72 moveto (PostScript tested.) show showpage" \
| /usr/local/libexec/cups/filter/pstops 1 saigel test 1 - \
| /usr/local/libexec/cups/filter/pstoraster | /usr/local/libexec/cups/filter/rastertokm2430dl 1 saigel test 1 -
```

Incidentally, I prefer those leading | symbols to make it obvious when a line is getting input from stdin.

That command works fine up to pstoraster, producing a data file.  rastertokm2430dl still hates it and core dumps, even with that missing options parameter set to zero.


----------



## saige (Jul 3, 2010)

wblock said:
			
		

> Just noticed that my printf was changed to echo.  It should be printf, they aren't interchangeable:



Oops, sorry. I am not used to seeing "printf" outside of C or Perl, and my mind automatically transliterated it to "echo".


----------



## saige (Jul 6, 2010)

Here I am replying to my own post again.

I am still not able to print. Last week I tried sending a report to the maintainer, but I haven't heard anything back from him.


----------



## saige (Jul 23, 2010)

I am confounded.

This thread has been open for over three weeks now, but I still don't have the ability to print using rastertokm2430dl. Following a suggestion from wblock, I have tried repeatedly to contact the port maintainer. No reply. Did research on Google, and it looks like the maintainer (Frank) got a new job at another company... Found his e-mail address at new company... Still no reply.

Well? Perhaps this port doesn't work on amd64 architecture? Perhaps the port is no longer being maintained?

Should I just ditch this printer and buy a new one?


----------



## wblock@ (Jul 24, 2010)

Buy used, if possible.  If you get another printer, please get one that understands a standard page description language, preferably PostScript.

If you are really attached to the KM printer, you can try building the magicolor port with debugging symbols (WITH_DEBUG=-g) and then running it with gdb to track down the error.  I tried that, but don't run CUPS and couldn't be sure about the error.  Someone on the mailing lists may be able to help with that.


----------

