More about hex and printing and gdi printers...

2009-12-14 Thread Peter Alcibiades
Well, thank you all for your help, and yes, it is licked, the hex that is!

What to do is, get a hex editor, I used ghex but there seem to be a huge 
number out there.  Then you just insert the hex characters into a text 
file.  ghex is very convenient because you can either type them in as hex 
or as ascii in the two panes, and it then shows what you have done in the 
other.  Maybe they all do this, ghex is the only one I've ever used.

Then to control the printer with this, you just do

put shell("cat yourfile > printer")

And lo and behold, the paper cutter instantly snips the paper!  The cash 
drawer is certain to open as well now that the method is figured out.  It 
is actually so simple to do, once you know how.  Like many things.

Peter
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: More about hex and printing and gdi printers...

2009-12-28 Thread Peter Alcibiades

Just for the sake of completeness, something probably most people here know,
but in case some other luckless amateur ends up struggling with this again,
there is at least one other way of doing this.

The first way was to edit a text file using a hex editor, then use a shell
command that uses the Unix cat command to redirect the contents of the file
to the printer, in our case lp0.

A simpler method that clutters up the program directory a bit less, and
maybe is less open to user errors, because you don't have to have mysterious
text files lying around, is to use echo as in


   echo -e "\x1B\x64\x30" > /dev/usb/lp0

Presumably this works with OSX as well.  What is happening is that the -e
enables interpretation of the escaped character which follows, and the
escaped character x signals that the following pair is a hex character. 
Anyway, do this with my particular printer, and the result is magic:  the
paper cutter operates!

This is so simple, assuming you have the hex codes to do things, that one
starts having fantasies of writing very simple printer drivers in Bash.  No, 
that way madness lies!

Peter
-- 
View this message in context: 
http://n4.nabble.com/More-about-hex-and-printing-and-gdi-printers-tp963411p989668.html
Sent from the Revolution - User mailing list archive at Nabble.com.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: More about hex and printing and gdi printers...

2009-12-28 Thread Peter Alcibiades

And by the way, one last thing.  When you do this, permissions will stop
ordinary users from addressing lp0.   Which obviously you will tell by
trying out the command from the terminal and discovering that it works with
su but not as ordinary user.   And putting the user into the lp group with
usermod does not fix this, I don't know why.  You could probably use suid,
but the simplest way may be to install sudo (which Ubuntu will already have)
and then edit the sudoers file to permit the user to use lp.  Otherwise
everything will be set up right, but it won't work.
-- 
View this message in context: 
http://n4.nabble.com/More-about-hex-and-printing-and-gdi-printers-tp963411p989671.html
Sent from the Revolution - User mailing list archive at Nabble.com.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution