On Tue, Mar 13, 2012 at 11:14 AM, V-CA ! Christoph Paschke
<c.pasc...@me.com> wrote:
> @Nemo
>
> Ok, I just want start with a very easy constellation:
>
> 1.) I installed octopus on top of my MacMini (newest version) at my
> televison in living room, he running also Mac-Server
> 2.) I got the terminal started at an older MacBook
> 3.) I have a HP Envy 100 WLAN Inkjet printer / Scanner integrated in WLAN,
> working at all my Macs
> 4.) Now I want to write a limbo program to print a page at that printer
>
> As I understand you, I cannot nativly run it by the P9 idea of device = file
> ... because the HP printer itself has no firmware to support such file based
> streaming, right?
>
> Therefore I need root through to mac a Mac sytem call to can adress the
> printer.
>
> As I understand, this is NOT the idea of a good Plan 9 / Limbo program? In
> my understanding: If I now write a small program that prints out for example
> a list of addresses, I need communicate with my printer in a streaming way
> and not by system calls, right?
>
> If I'm wrong, could you explain me, how I get my printer working.
>
> And, if it is to difficult with this HP printer and the system only can
> support old Epson ESC/P code for needle printer, just exlain me how I get
> that ESC/P printer working in the "Plan 9 ressource way"?
>
> For me it is most important that I can realize what is promised from that
> operting system according "all resources, also devices are a file"
> and that this idea is more than a theory!
>
> You understand what I ask?
>
> - Chris

So, here's what we did when we wanted to make Android
hardware/services accessible to Inferno--and this should work for you
too.

All of your Macs can print to the printer, presumably by using a
command something like "lp -d<printername> <filenames>". That's nice,
because you now have a reasonably simple abstracted interface to the
printer, which allows you to submit print jobs, check the queue, etc.

Now, write a device in Inferno which presents files like /dev/print or
whatever you want to call them, and executes commands on the Mac side
to actually do the work. Thus, if you write a file into /dev/print,
your driver should do something like run "lp" and feed it the file on
standard input.

You can take a look at
https://bitbucket.org/floren/inferno/src/75008e7031e1/emu/Android/devwifi.c,
specifically the wifiinit function, to see one crude example. The idea
there was to initialize Android's wifi device when the Inferno devwifi
device is initialized. Another example of translating actions in
Inferno into actions on the host system is
https://bitbucket.org/floren/inferno/src/75008e7031e1/emu/Android/devphone.c,
where we took commands written to the device files and translated them
into appropriate RIL (Android's radio daemon) commands to send out
over a socket on the Android side.

Once you figure out how the devices work in Inferno, it should be
pretty easy to write code that will link your file operations in
Inferno to the printing framework on the Macs.


John

Reply via email to