Project

General

Profile

Revision 72

packet now working fine

View differences:

mouse.c
58 58

  
59 59
int (mouse_set_data_report)(int on){
60 60
    int ret = 0;
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");
61
    if((ret = kbc_issue_cmd(MOUSE_WRITE_B))) return ret;
62
    if((ret = kbc_issue_arg(DIS_DATA_REP))) return ret;
64 63
    uint8_t ack = 0;
65
    if((ret = kbc_read_byte(&ack))) return ret;printf("L65\n");
64
    printf("L64\n");
65
    if((ret = kbc_read_byte(&ack))) return ret;
66
    printf("L66\n");
66 67
    printf("ACK: %x\n", ack);
67 68
    return SUCCESS;
68 69
}
......
77 78
int (mouse_issue_cmd)(uint32_t cmd) {
78 79
    int ret;
79 80
    uint8_t ack = 0;
80
    while (ack != ACK_ERROR) {
81
    for(unsigned i = 0; i < KBC_NUM_TRIES; ++i) {
81 82
        if ((ret = kbc_issue_cmd(MOUSE_WRITE_B))) return ret;
82 83
        if ((ret = kbc_issue_arg(cmd))) return ret;
83 84
        if ((ret = mouse_read_byte(&ack))) return ret;
84 85
        if (ack == ACK_OK) return SUCCESS;
86
        if (ack == ACK_ERROR) return INVALID_COMMAND;
85 87
        tickdelay(micros_to_ticks(DELAY));
86 88
    }
87
    return INVALID_COMMAND;
89
    return TIMEOUT_ERROR;
88 90
}
89 91

  
90 92
int (mouse_read_byte)(uint8_t *byte) {

Also available in: Unified diff