You are not logged in.
I wanted to thank all of you especially stopstop and jdbrody for helping me track this down. I am having the same problem on a Gentoo system. Since several people still seem to lack a solution, and a fixed version of file probably won't be forthcoming anytime soon, I'll share my solution.
The problem file is having detecting postscript is caused by 1 byte on the end of the print file: 0x04. Looking up this ASCII control code tells me that this is an “end of transmission” code. The other character jdbrody mentioned is actually a line feed (harmless enough). I tried stripping this code out and it actually works fine without it. But since the “end of transmission” code probably SHOULD be in there my solution is to create a separate tmp file with the code stripped just for file to check.
I am assuming all the filter files for various models are fairly similar. My printer is a HL-5340D, so alter accordingly.
Make a backup of /usr/local/Brother/lpd/filterHL5340D before editing.
My edited filter file lines 32 – 41 look like:
INPUT_TEMP=`mktemp /tmp/br_input.XXXXXX`
INPUT_TEMP0=`mktemp /tmp/br_input.XXXXXX`
INPUT_TEMP1=`mktemp /tmp/br_input.XXXXXX`
cat > $INPUT_TEMP1
LENGTH=`wc -c $INPUT_TEMP1 | cut -d' ' -f1`
let LENGTH-=1
head -c $LENGTH $INPUT_TEMP1 > $INPUT_TEMP0
FILE_TYPE=`file $INPUT_TEMP0 | sed -e 's/^.*:[ ]*//' -e 's/[ ].*//'`
My changes are as follows:
# make a new extra tmp file I call INPUT_TEMP0
INPUT_TEMP0=`mktemp /tmp/br_input.XXXXXX`
# get the length of INPUT_TEMP1 in bytes and subtract 1
LENGTH=`wc -c $INPUT_TEMP1 | cut -d' ' -f1`
let LENGTH-=1
# copy INPUT_TEMP1 to INPUT_TEMP0 minus that pesky EOT code
head -c $LENGTH $INPUT_TEMP1 > $INPUT_TEMP0
# change this line so it checks INPUT_TEMP0 instead of INPUT_TEMP1
FILE_TYPE=`file $INPUT_TEMP0 | sed -e 's/^.*:[ ]*//' -e 's/[ ].*//'`
Also around line 249 almost at the end of the script where the other 2 tmp files get deleted, remove your extra tmp file also.
rm -f $INPUT_TEMP0
Thanks again
I hope this helps someone.
Last edited by Hwy (2011-05-29 06:58:05)
Offline
Yes, it helped!!! Many thanks to Hwy for his solution and to everybody that helped in solving this problem!
Although my Brother filter complained about the missing 'a2ps' command, I didn't need to install this package. Now, it doesn't complain any more about the missing command. I guess that the filter wanted to use 'a2ps' because the 'file' command did not work?
Offline
The solution in the post by Hwy dated 2011-05-29 01:52:42 worked for me as well. Thanks!
Offline