Revision 69
not deactivating reporting, dont know why
lab4/kbc.c | ||
---|---|---|
67 | 67 |
int ret = 0; |
68 | 68 |
uint8_t stat; |
69 | 69 |
for(int i = 0; i < KBC_NUM_TRIES; ++i){ |
70 |
if((ret = util_sys_inb(STATUS_REG, &stat))) return ret; |
|
71 |
if((stat&OUT_BUF_FUL) && (stat&AUX_MOUSE)==0){ |
|
72 |
if(stat & (PARITY_ERROR | TIME_OUT_REC)) return 1;
|
|
70 |
if((ret = util_sys_inb(STATUS_REG, &stat))) return ret;//printf("kbc.c,L71\n");
|
|
71 |
if((stat&OUT_BUF_FUL) && (stat&AUX_MOUSE)==0){//printf("kbc.c,L72\n");
|
|
72 |
if(stat & (PARITY_ERROR | TIME_OUT_REC)) return OTHER_ERROR;//printf("kbc.c,L73\n");
|
|
73 | 73 |
if((ret = util_sys_inb(OUTPUT_BUF, byte))) return ret; |
74 | 74 |
else return SUCCESS; |
75 | 75 |
} |
lab4/kbc_macros.h | ||
---|---|---|
8 | 8 |
|
9 | 9 |
/* Delay for KBC */ |
10 | 10 |
#define DELAY 20000 /* @brief KBC Response Delay */ |
11 |
#define KBC_NUM_TRIES 10 /* @brief Number of tries to issue command before timeout */
|
|
11 |
#define KBC_NUM_TRIES 20 /* @brief Number of tries to issue command before timeout */
|
|
12 | 12 |
|
13 | 13 |
/* I/O Ports Addresses */ |
14 | 14 |
|
lab4/lab4.c | ||
---|---|---|
74 | 74 |
} |
75 | 75 |
|
76 | 76 |
if (unsubscribe_interrupt(&mouse_id)) return 1; |
77 |
|
|
78 |
if(mouse_set_data_report(false)) return 1; |
|
79 |
|
|
77 |
int ret = mouse_set_data_report(false); |
|
78 |
printf("%d\n", ret); |
|
80 | 79 |
return 0; |
81 | 80 |
} |
82 | 81 |
|
lab4/mouse.c | ||
---|---|---|
58 | 58 |
|
59 | 59 |
int (mouse_set_data_report)(int on){ |
60 | 60 |
int ret = 0; |
61 |
if((ret = kbc_issue_cmd(MOUSE_WRITE_B))) return ret; |
|
62 |
if((ret = kbc_issue_arg(DIS_DATA_REP))) return ret; |
|
61 |
printf("L61\n"); |
|
62 |
if((ret = kbc_issue_cmd(MOUSE_WRITE_B))) return ret; printf("L62\n"); |
|
63 |
if((ret = kbc_issue_arg(DIS_DATA_REP))) return ret; printf("L63\n"); |
|
64 |
uint8_t ack = 0; |
|
65 |
if((ret = kbc_read_byte(&ack))) return ret;printf("L65\n"); |
|
66 |
printf("ACK: %x\n", ack); |
|
63 | 67 |
return SUCCESS; |
64 | 68 |
} |
Also available in: Unified diff