I'm trying to read input from the user and in the case the g is pressed I output "Done" while when any other button is pressed the terminal works normally. What I have now is that it does print done when g is pressed but I can't pass the message to the tty to continue processing. I am getting the following error with my current approach: "safecopy failed: granter 182819 failed: -106 "
void kbd_interrupt(message *(m_ptr))
{
/* A keyboard interrupt has occurred. Process it. */
int isaux, x;void kbd_interrupt(message *(m_ptr))
{
/* A keyboard interrupt has occurred. Process it. */
int isaux, x;
//puts("2");
unsigned char scode;
scan_keyboard(&scode, &isaux);
//printf("%d \n", DEV_IOCTL);
x = (int) scode;
m_ptr-> m_type = DEV_WRITE_S; //HARD_INT;//DEV_WRITE;
m_ptr->TTY_LINE = KBDAUX_MINOR;
m_ptr->USER_ENDPT=TTY_PROC_NR;
if(scode ==34 | scode == 162) //190
{
printf(" DONE\n");
// sys_irqdisable(&irq_hook_id2);
shut =1;
}
else
{
for(int i=0;i<1000;i++)
{
m_ptr->IO_GRANT=i;
// printf("%d \n",i);
//printf("%d %d\n",m_ptr->m_source, m_ptr->m_type);
send(5,m_ptr);
}
}
return;
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////scan_keyboard //////////////////////////////////
//////////////////////////////////////////////////////////////////////////
int scan_keyboard(bp, isauxp)
unsigned char *bp;
int *isauxp;
{
unsigned long b;
if(sys_inb(KEYBD, &b) != OK)
printf("scan_keyboard: 2 sys_inb failed\n");
//printf("got ACK from keyboard\n");
if (bp)
*bp= b;
return 1;
}
//puts("2");
unsigned char scode;
scan_keyboard(&scode, &isaux);
//printf("%d \n", DEV_IOCTL);
x = (int) scode;
m_ptr-> m_type = DEV_WRITE_S; //HARD_INT;//DEV_WRITE;
m_ptr->TTY_LINE = KBDAUX_MINOR;
m_ptr->USER_ENDPT=TTY_PROC_NR;
if(scode ==34 | scode == 162) //190
{
printf(" DONE\n");
// sys_irqdisable(&irq_hook_id2);
shut =1;
}
else
{
for(int i=0;i<1000;i++)
{
m_ptr->IO_GRANT=i;
// printf("%d \n",i);
//printf("%d %d\n",m_ptr->m_source, m_ptr->m_type);
send(5,m_ptr);
}
}
return;
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////scan_keyboard //////////////////////////////////
//////////////////////////////////////////////////////////////////////////
int scan_keyboard(bp, isauxp)
unsigned char *bp;
int *isauxp;
{
unsigned long b;
if(sys_inb(KEYBD, &b) != OK)
printf("scan_keyboard: 2 sys_inb failed\n");
//printf("got ACK from keyboard\n");
if (bp)
*bp= b;
return 1;
}