For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > November 2005 > Q: How to send RESET to USB printer?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Q: How to send RESET to USB printer?
vitaly_il@yahoo.com

2005-11-28, 3:57 am

I'm trying to send RESET to USB printer (Samsung SPP-2040) using the
following code:

#include <sys/ioctl.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/lp.h>
#include <linux/usb.h>

int print_d, ioctl_return;
unsigned int status;

// printf ("LPRESET=%d\n",LPRESET);

if ((print_d = open("/dev/usb/lp0",O_RDWR|O_EXCL)) == -1 )
{perror("open lp0 failed "); exit(1);}

if ((ioctl_return = ioctl(print_d, LPRESET)) == -1)
perror("ioctl failed ");
}

but I'm receiving "ioctl failed : Inappropriate ioctl for device"
message.

What's wrong with this code?
Thanks,
Vitaly

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com