|
|
|
|
|
|
|
|
int usb_audio_get_feature(void *stp, uint8_t *data, uint32_t *datalen) |
|
|
int usb_audio_get_feature(void *stp, uint8_t *data, uint32_t *datalen) |
|
|
{ |
|
|
{ |
|
|
struct setup_struct setup = *((struct setup_struct *)stp); |
|
|
struct setup_struct setup = *((struct setup_struct *)stp); |
|
|
if (setup.bmRequestType==0xA1) { // should check bRequest too, and UnitID |
|
|
|
|
|
if (setup.bChannel==0) { // only support main, but in theory could do left/right as well |
|
|
|
|
|
|
|
|
if (setup.bmRequestType==0xA1) { // should check bRequest, bChannel, and UnitID |
|
|
if (setup.bCS==0x01) { // mute |
|
|
if (setup.bCS==0x01) { // mute |
|
|
data[0] = AudioInputUSB::features.mute; // 1=mute, 0=unmute |
|
|
data[0] = AudioInputUSB::features.mute; // 1=mute, 0=unmute |
|
|
*datalen = 1; |
|
|
*datalen = 1; |
|
|
|
|
|
|
|
|
*datalen = 2; |
|
|
*datalen = 2; |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
return 0; |
|
|
|
|
|
} |
|
|
} |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
int usb_audio_set_feature(void *stp, uint8_t *buf) |
|
|
int usb_audio_set_feature(void *stp, uint8_t *buf) |
|
|
{ |
|
|
{ |
|
|
struct setup_struct setup = *((struct setup_struct *)stp); |
|
|
struct setup_struct setup = *((struct setup_struct *)stp); |
|
|
if (setup.bmRequestType==0x21) { // should check bRequest too, and UnitID |
|
|
|
|
|
if (setup.bChannel==0) { |
|
|
|
|
|
|
|
|
if (setup.bmRequestType==0x21) { // should check bRequest, bChannel and UnitID |
|
|
if (setup.bCS==0x01) { // mute |
|
|
if (setup.bCS==0x01) { // mute |
|
|
if (setup.bRequest==0x01) { // SET_CUR |
|
|
if (setup.bRequest==0x01) { // SET_CUR |
|
|
AudioInputUSB::features.mute = buf[0]; // 1=mute,0=unmute |
|
|
AudioInputUSB::features.mute = buf[0]; // 1=mute,0=unmute |
|
|
|
|
|
|
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |