ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
if(printer0.dev == NULL)
printk(KERN_ERR "Could not register driver with port");
else
printer0.flags |= F_EXIST;
}
void p_detach (struct parport *port)
{
}
/*to check if printer is out of power or not*/
int p_check()
{
unsigned int status1,status2,retval;
// int i=40;
lp_claim_parport_or_block(&printer0);
// parport_claim_or_block (printer0.dev);
/*function to check the status of printer through its status register*/
int check_printer_status()
{
int error = 0;
unsigned int last = printer0.last_error;
unsigned char status = read_status();
// int temp = (int) status;
/* to check if printer is out of paper*/
else if(status == 0x67)
{
if(last != PS_OUT_PAPER)
{ last = PS_OUT_PAPER;
printk("<0> Printer out of paper\n");
// printk("\ntemp=%X",temp);
}
error = -ENOSPC;
}
/*to check if printer is off-line*/
else if((status & PS_SELECTED))
{
if(last != PS_SELECTED)
{
last = PS_SELECTED;
printk("<0> Printer is off-line\n");
// printk("\nstatus = %x\n",status);
// printk("\ntemp=%X",temp);
}
error = -EIO;
}
else if(!(status & PS_ERROR))
{
if(last != PS_ERROR)
{
last = PS_ERROR;
printk("<0> Printer fault:check the printer\n");
}
/*initializing all data items of printer0*/
/*the printer0 is a variable of type 'struct printer'*/
printer0.dev = NULL;/*local variable */
printer0.flags = 0;/*flags defined in struct printer...*/
printer0.chars =P_INIT_CHAR;/*chars for busy time out*/
/* The parallel port specs apparently say that there needs to be
* a .5usec wait before and after the strobe. defined in lp.h
*/
printer0.time =P_INIT_TIME;/*time for wait time*/
printer0.wait =P_INIT_WAIT;/*wait for strobe wait*/
/* This is the amount of time that the driver waits for the printer to
* catch up when the printer's buffer appears to be filled. If you
* want to tune this and have a fast printer (i.e. HPIIIP), decrease
* this number, and if you have a slow printer, increase this number.
* This is in hundredths of a second, the default 2 being .05 second.
* Or use the tunelp(8) command, which is especially nice if you want
* change back and forth between character and graphics printing, which
* are wildly different...
*/
these r the errors i m getting ...
how to correct them...
i m quoting few of them
Quote:
/root/Desktop/lodu/myprinte.c
In file included from /usr/src/linux-2.4.26/include/linux/sched.h:14,
from /root/Desktop/lodu/myprinte.c:10:
/usr/include/linux/timex.h:173: error: field `time' has incomplete type
In file included from /usr/src/linux-2.4.26/include/linux/sched.h:21,
from /root/Desktop/lodu/myprinte.c:10:
/usr/include/asm/mmu.h:12: error: field `sem' has incomplete type
In file included from /root/Desktop/lodu/myprinte.c:15:
/usr/include/linux/console.h:47: error: parse error before "u8"
/usr/include/linux/console.h:48: error: parse error before "u16"
/usr/include/linux/console.h:49: error: parse error before '*' token
/usr/include/linux/console.h:51: error: parse error before '}' token
/usr/include/linux/console.h:100: error: parse error before "kdev_t"
/usr/include/linux/console.h:107: error: parse error before '}' token
In file included from /root/Desktop/lodu/myprinte.c:22:
/usr/include/asm/uaccess.h: In function `verify_area':
/usr/include/asm/uaccess.h:106: error: `current' undeclared (first use in this function)
/usr/include/asm/uaccess.h:106: error: (Each undeclared identifier is reported only once
/usr/include/asm/uaccess.h:106: error: for each function it appears in.)
/usr/include/asm/uaccess.h: In function `__constant_copy_to_user':
/usr/include/asm/uaccess.h:669: error: `current' undeclared (first use in this function)
/usr/include/asm/uaccess.h: In function `__constant_copy_from_user':
/usr/include/asm/uaccess.h:677: error: `current' undeclared (first use in this function)
/root/Desktop/lodu/myprinte.c:25:24: linux/saav.h: No such file or directory
/root/Desktop/lodu/myprinte.c: In function `lp_claim_parport_or_block':
/root/Desktop/lodu/myprinte.c:46: error: dereferencing pointer to incomplete type
/root/Desktop/lodu/myprinte.c:46: error: dereferencing pointer to incomplete type
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.