From owner-freebsd-questions@FreeBSD.ORG Tue Sep 21 00:42:25 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A1BE106566B for ; Tue, 21 Sep 2010 00:42:25 +0000 (UTC) (envelope-from cpghost@cordula.ws) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id E1FC78FC0A for ; Tue, 21 Sep 2010 00:42:24 +0000 (UTC) Received: by qyk31 with SMTP id 31so3660270qyk.13 for ; Mon, 20 Sep 2010 17:42:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.28.144 with SMTP id m16mr6406841qac.357.1285029742884; Mon, 20 Sep 2010 17:42:22 -0700 (PDT) Received: by 10.229.98.199 with HTTP; Mon, 20 Sep 2010 17:42:22 -0700 (PDT) X-Originating-IP: [93.203.61.181] In-Reply-To: <201009201716.o8KHGpxf013791@mail.r-bonomi.com> References: <201009201716.o8KHGpxf013791@mail.r-bonomi.com> Date: Tue, 21 Sep 2010 02:42:22 +0200 Message-ID: From: "C. P. Ghost" To: Robert Bonomi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-questions@freebsd.org Subject: Re: The nightmarish problem of installing a printer X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2010 00:42:25 -0000 On Mon, Sep 20, 2010 at 7:16 PM, Robert Bonomi w= rote: > "Adapting" =A0MS-Windows print drivers is not 'practical' either. =A0A wi= ndows > print driver is embedd in the O/S KERNEL, =A0with _system_ calls_ (not > mere 'library' routines) that implement the 'device-dependant' rendering > of layout/formating directions. =A0One then takes the 'opaque object' so > produced and sends it (via _another_ set of system calls) to the 'output' > function of that same driver. Is that really so? How about writing some emulation shim like ndis(4) for winprinters? Please correct me if I'm wrong, as I'm not a Windows systems programmer, but this is what I'm thinking about. As far as I understand Windows printing, there are two aspects to resolve, given a vendor supplied windriver binary blob: 1/ the windriver gets some (opaque) data from the GDI+ -- maybe a bitmap, with some meta data. 2/ the windriver interprets this data however it sees fit, and then talks t= o the NT kernel (maybe via DLL calls) to send electrical impulses to the printer. Now, the data formats of 1/ (GDI stuff) is probably well defined (and therefore published) in gdiplus.dll or something similar and is the same for all windriver blobs. The API/ABI needed to talk to the NT kernel is probably defined in the Windows DDK (or whatever it is called nowadays). So, in both cases, we have stable API/ABI interfaces on both sides of the windriver binary blob: 1/, 2/ at the upper half, and 2/ at the botto= m half. So, if we wanted to use those windriver blobs just like in the ndis(4) case, all we need is an emulation shim for both interfaces. Maybe 1/ is already covered by Wine (?) so we could borrow some code from there; and 2/ is basically a matter of mapping the subset of NT calls needed to read from and write to Windows ports to Unix calls to read and write to our Unix devices. Again, I'm no Windows programmer, and it is probably more involved than this. But the basic idea remains: the interfaces on both sides of the windriver binary blobs is pretty stable and (I think) not a secret at all. > In the Unix world, printing is handled _externally_ to the kernel. The > application must have =3Dits=3Down=3Dmeans=3D of deciding what formatting= /layout > commands to use -- it _can't_ query the O/S for this info; the O/S simply > doesn't have it. Well, it doesn't matter if the windriver shims run as userland daemon or (partially) inside the kernel. The point here is that the windriver <-> NT, and windriver <-> GDI+ interface are both stable and not difficult to understand, so both can be emulated. At least theoretically. In practice, it takes some time and effort to get it right, quite obviously. -cpghost. --=20 Cordula's Web. http://www.cordula.ws/