From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <7f04f2be-b0de-6d02-ea00-ec856c58fb7c@me.com> References: <7f04f2be-b0de-6d02-ea00-ec856c58fb7c@me.com> Date: Tue, 13 Mar 2012 12:56:22 -0700 Message-ID: From: John Floren To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] For first ONLY a laser printer in this resource meaning Topicbox-Message-UUID: 682d6a3e-ead7-11e9-9d60-3106f5b1d025 On Tue, Mar 13, 2012 at 11:14 AM, V-CA ! Christoph Paschke wrote: > @Nemo > > Ok,=A0I just want start with a very easy constellation: > > 1.) I installed octopus=A0on top of my=A0MacMini (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 =3D= file > ... because the HP printer itself has no firmware to support such file ba= sed > streaming, right? > > Therefore I need root through to=A0mac a=A0Mac sytem call to can adress t= he > printer. > > As I understand, this is NOT the idea of a good Plan 9 / Limbo program? I= n > my understanding: If I now write a small program that prints out for exam= ple > a list of addresses, I need communicate with my printer in a streaming wa= y > 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=A0resources, also devices are=A0a file" > and=A0that=A0this idea=A0is more than a theory! > > You understand what I=A0ask? > > - 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 ". 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