Ticket #79: guitar.diff

File guitar.diff, 2.6 kB (added by folg, 3 years ago)
  • trunk/libcwiid/cwiid_internal.h

     
    125125#define CLIFF_IR_BLOCK_2        "\x63\x03" 
    126126 
    127127/* Extension Decode */ 
    128 #define DECODE(a)       (((a ^ 0x17)+0x17)&0xFF) 
     128//#define DECODE(a)     (((a ^ 0x17)+0x17)&0xFF) 
     129#define DECODE(a)       (a) 
    129130 
    130131/* Write Sequences */ 
    131132enum write_seq_type { 
  • trunk/libcwiid/thread.c

     
    192192 
    193193                if (status_mesg->ext_type == CWIID_EXT_UNKNOWN) { 
    194194                        if (wiimote->state.ext_type == CWIID_EXT_NONE) { 
    195                                 buf = 0x00; 
     195                                buf = 0x55; 
    196196                                /* Initialize extension register space */ 
    197                                 if (cwiid_write(wiimote, CWIID_RW_REG, 0xA40040, 1, &buf)) { 
     197                                if (cwiid_write(wiimote, CWIID_RW_REG, 0xA400F0, 1, &buf)) { 
    198198                                        cwiid_err(wiimote, "Extension initialization error"); 
    199199                                        status_mesg->ext_type = CWIID_EXT_UNKNOWN; 
    200200                                } 
    201                                 /* Read extension ID */ 
    202                                 else if (cwiid_read(wiimote, CWIID_RW_REG | CWIID_RW_DECODE, 
    203                                                     0xA400FE, 1, &buf)) { 
    204                                         cwiid_err(wiimote, "Read error (extension error)"); 
    205                                         status_mesg->ext_type = CWIID_EXT_UNKNOWN; 
    206                                 } 
    207201                                else { 
    208                                         switch (buf) { 
    209                                         case EXT_NONE: 
    210                                         case EXT_PARTIAL: 
    211                                                 status_mesg->ext_type = CWIID_EXT_NONE; 
    212                                                 break; 
    213                                         case EXT_NUNCHUK: 
    214                                                 status_mesg->ext_type = CWIID_EXT_NUNCHUK; 
    215                                                 break; 
    216                                         case EXT_CLASSIC: 
    217                                                 status_mesg->ext_type = CWIID_EXT_CLASSIC; 
    218                                                 break; 
    219                                         default: 
     202                                        buf=0x00;  
     203                                        if (cwiid_write(wiimote, CWIID_RW_REG, 0xA400FB, 1, &buf)) { 
     204                                                cwiid_err(wiimote, "Extension initialization error"); 
    220205                                                status_mesg->ext_type = CWIID_EXT_UNKNOWN; 
    221                                                 break; 
    222206                                        } 
     207                                        /* Read extension ID */ 
     208                                        else if (cwiid_read(wiimote, CWIID_RW_REG | CWIID_RW_DECODE, 
     209                                                            0xA400FE, 1, &buf)) { 
     210                                                cwiid_err(wiimote, "Read error (extension error)"); 
     211                                                status_mesg->ext_type = CWIID_EXT_UNKNOWN; 
     212                                        } 
     213                                        else { 
     214                                                switch (buf) { 
     215                                                case EXT_NONE: 
     216                                                case EXT_PARTIAL: 
     217                                                        status_mesg->ext_type = CWIID_EXT_NONE; 
     218                                                        break; 
     219                                                case EXT_NUNCHUK: 
     220                                                        status_mesg->ext_type = CWIID_EXT_NUNCHUK; 
     221                                                        break; 
     222                                                case EXT_CLASSIC: 
     223                                                        status_mesg->ext_type = CWIID_EXT_CLASSIC; 
     224                                                        break; 
     225                                                default: 
     226                                                        status_mesg->ext_type = CWIID_EXT_UNKNOWN; 
     227                                                        break; 
     228                                                } 
     229                                        } 
    223230                                } 
    224231                        } 
    225232                        else {