void usb_setupcommand(void) { if (dx.cepsts & CEP_IRQ_STAT_SETUPPACKETINT) { dx.temp = readreg(SETUP1_0); dx.setuppackage.bmRequestType = dx.temp & 0xff; dx.setuppackage.bRequest = (dx.temp & 0xff00) >> 8; dx.setuppackage.wValue = readreg(SETUP3_2); dx.setuppackage.wIndex = readreg(SETUP5_4); dx.setuppackage.wLength = readreg(SETUP7_6); switch (dx.setuppackage.bRequest) { case GET_STATUS: usb_getstatus(); break; case CLEAR_FEATURE: usb_clearfeature(); break; case RSVD_1: case RSVD_2: usb_rsvd(); break; case SET_FEATURE: usb_setfeature(); break; case SET_ADDRESS: usb_setaddress(); break; case GET_DESCRIPTOR: usb_getdescriptor(); break; case SET_DESCRIPTOR: usb_setdescriptor(); break; case GET_CONFIGURATION: usb_getconfiguration(); break; case SET_CONFIGURATION: usb_setconfiguration(); break; case GET_INTERFACE: usb_getinterface(); break; case SET_INTERFACE: usb_setinterface(); break; case SYNCH_FRAME: usb_synchframe(); break; case GET_MAX_LUN: usb_getmaxlun(); break; case BULK_MASS_STORAGE_RESET: usb_massreset(); default: usb_default(); break; } }
void EM2874Device::startStream() { if (isStream) return; writeReg(EM2874_REG_TS_ENABLE, EM2874_TS1_CAPTURE_ENABLE | EM2874_TS1_NULL_DISCARD); usb_setinterface(fd, 0, 1); ts_func = new TsIoThread (fd, EM2874_EP_TS1); ts_thread = new boost::thread(boost::ref(*ts_func)); isStream = true; }