How do talk with printer
sivakumar
idyakavi at yahoo.com
Thu Nov 12 01:09:32 PST 2009
Hi,
I am using Fedora 10 GNOME Desktop and CUPS 1.4.2.I want to update my ppd for that i make a test but it doesnt update any thing in PPD file here with i posted my ppd code.
The following code written in "filter/rastertolabel.c"
fputs("PPD: OptionDuplex=False\n",stderr);
the following code is my PPD
*OpenGroup: InstallableOptions/Device Settings
*OpenUI *OptionDuplex/Duplexer Installed: Boolean
*OrderDependency: 10 AnySetup *OptionDuplex
*DefaultOptionDuplex: True
*OptionDuplex False/Not Installed: ""
*OptionDuplex True/Installed: ""
*CloseUI: *OptionDuplex
*CloseGroup: InstallableOptions
thanking you
> Please don't write code like this - normal users don't have access to
> USB device files.
>
> If you do this as a filter, you'll send your commands to stdout and
> read the response back using cupsBackChannelRead. After you read the
> buffer (which you must then nul-terminate if it is ordinary text),
> validate the value in the buffer before using it!
>
> Also, your fprintf is missing a newline at the end and the colon after
> "PPD" - it should read like this:
>
> fprintf(stderr, "PPD: RibbonLength=%s\n", buff);
>
> Again, you'll need to nul-terminate your buffer (buff[retv] = '\0') to
> use it this way, and you absolutely should be validating the buffer
> otherwise you could be writing random garbage to the PPD file.
>
> On Nov 11, 2009, at 4:34 AM, sivakumar wrote:
>
> > Hi,
> >
> >
> > I want to talk with the printer i written some code that follows,
> >
> > USBOpen()
> > {
> > char buff[256] = {0};
> > int fd=open("\dev\usb\lp0",O_RDWR);
> >
> > memset(buff,0,sizeof(buff));
> > sprintf(buff,"\033!RIBLEN\r");
> > retv = write(fd,buff,strlen(buff));
> > memset(buff,0,sizeof(buff));
> > retv = write(fd,"\033E 2\r",strlen("\033E 2\r"));
> > retv = read(fd,buff,sizeof(buff));
> >
> > fprintf(stderr,"PPD RibbonLength=%s",buff);
> >
> > }
> >
> > where i should place the code (BackEnd/Filter/Shuduler),and i want
> > to update this one to PPD file.
> >
> > I am using
> >
> > Fedora 10 OS
> > GNOME Desktop
> > CUPS 1.3
> >
> >
> > Thanking You
> >
> > _______________________________________________
> > cups-ddk mailing list
> > cups-ddk at easysw.com
> > http://lists.easysw.com/mailman/listinfo/cups-ddk
>
> ___________________________________________________
> Michael Sweet, Senior Printing System Engineer
>
>
>
More information about the cups
mailing list