UVC host library
Dependents: LifeCam WebcamServer
uvc/uvcini.cpp@2:812d604caad4, 2012-08-08 (annotated)
- Committer:
- va009039
- Date:
- Wed Aug 08 16:21:32 2012 +0000
- Revision:
- 2:812d604caad4
- Parent:
- 0:b0f04c137829
Logitech C270
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 0:b0f04c137829 | 1 | #include "mbed.h" |
va009039 | 0:b0f04c137829 | 2 | #include "uvc.h" |
va009039 | 0:b0f04c137829 | 3 | #define __DEBUG |
va009039 | 0:b0f04c137829 | 4 | #include "mydbg.h" |
va009039 | 0:b0f04c137829 | 5 | #include "stcamcfg.h" |
va009039 | 0:b0f04c137829 | 6 | |
va009039 | 0:b0f04c137829 | 7 | #define UNDEF_VAL (0) |
va009039 | 0:b0f04c137829 | 8 | const struct stcamcfg stcamcfg_table[] = { |
va009039 | 0:b0f04c137829 | 9 | /* |
va009039 | 0:b0f04c137829 | 10 | {0x045e, 0x074a, "Microsoft LifeCam VX-700", |
va009039 | 0:b0f04c137829 | 11 | 160,120, PAYLOAD_MJPEG, |
va009039 | 0:b0f04c137829 | 12 | 0x81, 128, |
va009039 | 0:b0f04c137829 | 13 | 1, 5, 2000000, // 160x120 5.0fps |
va009039 | 0:b0f04c137829 | 14 | 1, 1, |
va009039 | 0:b0f04c137829 | 15 | 8, 3, |
va009039 | 0:b0f04c137829 | 16 | },*/ |
va009039 | 0:b0f04c137829 | 17 | /* |
va009039 | 0:b0f04c137829 | 18 | {0x0c45, 0x62c0, "UVCA130AF", |
va009039 | 0:b0f04c137829 | 19 | 160,120, PAYLOAD_MJPEG, |
va009039 | 0:b0f04c137829 | 20 | 0x81, 128, |
va009039 | 0:b0f04c137829 | 21 | 1, 5, 2000000, // 160x120 5.0fps |
va009039 | 0:b0f04c137829 | 22 | 1, 1, |
va009039 | 0:b0f04c137829 | 23 | 8, 3, |
va009039 | 0:b0f04c137829 | 24 | },*/ |
va009039 | 0:b0f04c137829 | 25 | |
va009039 | 0:b0f04c137829 | 26 | {0x046d, 0x0994, "Logitech QuickCam Orbit AF", |
va009039 | 0:b0f04c137829 | 27 | 160,120, PAYLOAD_MJPEG, |
va009039 | 0:b0f04c137829 | 28 | UNDEF_VAL, UNDEF_VAL, |
va009039 | 0:b0f04c137829 | 29 | UNDEF_VAL, UNDEF_VAL, 2000000, // 160x120 10.0fps |
va009039 | 0:b0f04c137829 | 30 | UNDEF_VAL, UNDEF_VAL, |
va009039 | 0:b0f04c137829 | 31 | UNDEF_VAL, 3, |
va009039 | 0:b0f04c137829 | 32 | }, |
va009039 | 0:b0f04c137829 | 33 | {0x0000, 0x0000, "default", |
va009039 | 0:b0f04c137829 | 34 | 160,120, PAYLOAD_MJPEG, |
va009039 | 0:b0f04c137829 | 35 | UNDEF_VAL, UNDEF_VAL, |
va009039 | 0:b0f04c137829 | 36 | UNDEF_VAL, UNDEF_VAL, 2000000, |
va009039 | 0:b0f04c137829 | 37 | UNDEF_VAL, UNDEF_VAL, |
va009039 | 0:b0f04c137829 | 38 | UNDEF_VAL, 3, |
va009039 | 0:b0f04c137829 | 39 | }, |
va009039 | 0:b0f04c137829 | 40 | }; |
va009039 | 0:b0f04c137829 | 41 | |
va009039 | 0:b0f04c137829 | 42 | inline void LE32(uint32_t n, uint8_t* d) |
va009039 | 0:b0f04c137829 | 43 | { |
va009039 | 0:b0f04c137829 | 44 | d[0] = (uint8_t)n; |
va009039 | 0:b0f04c137829 | 45 | d[1] = (uint8_t)(n >> 8); |
va009039 | 0:b0f04c137829 | 46 | d[2] = (uint8_t)(n >> 16); |
va009039 | 0:b0f04c137829 | 47 | d[3] = (uint8_t)(n >> 24); |
va009039 | 0:b0f04c137829 | 48 | } |
va009039 | 0:b0f04c137829 | 49 | |
va009039 | 0:b0f04c137829 | 50 | void uvc::SetFormatIndex(int index) |
va009039 | 0:b0f04c137829 | 51 | { |
va009039 | 0:b0f04c137829 | 52 | DBG_ASSERT(index >= 1); |
va009039 | 0:b0f04c137829 | 53 | DBG_ASSERT(index <= 2); |
va009039 | 0:b0f04c137829 | 54 | m_FormatIndex = index; |
va009039 | 0:b0f04c137829 | 55 | } |
va009039 | 0:b0f04c137829 | 56 | |
va009039 | 0:b0f04c137829 | 57 | void uvc::SetFrameIndex(int index) |
va009039 | 0:b0f04c137829 | 58 | { |
va009039 | 0:b0f04c137829 | 59 | DBG_ASSERT(index >= 1); |
va009039 | 0:b0f04c137829 | 60 | DBG_ASSERT(index <= 8); |
va009039 | 0:b0f04c137829 | 61 | m_FrameIndex = index; |
va009039 | 0:b0f04c137829 | 62 | } |
va009039 | 0:b0f04c137829 | 63 | |
va009039 | 0:b0f04c137829 | 64 | void uvc::SetFrameInterval(int val) |
va009039 | 0:b0f04c137829 | 65 | { |
va009039 | 0:b0f04c137829 | 66 | DBG_ASSERT(val >= 333333); |
va009039 | 0:b0f04c137829 | 67 | DBG_ASSERT(val <= 10000000); |
va009039 | 0:b0f04c137829 | 68 | m_FrameInterval = val; |
va009039 | 0:b0f04c137829 | 69 | } |
va009039 | 0:b0f04c137829 | 70 | |
va009039 | 0:b0f04c137829 | 71 | void uvc::SetPacketSize(int size) |
va009039 | 0:b0f04c137829 | 72 | { |
va009039 | 0:b0f04c137829 | 73 | DBG_ASSERT(size >= 128); |
va009039 | 0:b0f04c137829 | 74 | DBG_ASSERT(size <= 1024); |
va009039 | 0:b0f04c137829 | 75 | m_PacketSize = size; |
va009039 | 0:b0f04c137829 | 76 | } |
va009039 | 0:b0f04c137829 | 77 | |
va009039 | 0:b0f04c137829 | 78 | void uvc::SetImageSize(int width, int height) |
va009039 | 0:b0f04c137829 | 79 | { |
va009039 | 0:b0f04c137829 | 80 | DBG_ASSERT(width >= 160); |
va009039 | 0:b0f04c137829 | 81 | DBG_ASSERT(width <= 800); |
va009039 | 0:b0f04c137829 | 82 | DBG_ASSERT(height >= 120); |
va009039 | 0:b0f04c137829 | 83 | DBG_ASSERT(height <= 600); |
va009039 | 0:b0f04c137829 | 84 | m_width = width; |
va009039 | 0:b0f04c137829 | 85 | m_height = height; |
va009039 | 0:b0f04c137829 | 86 | } |
va009039 | 0:b0f04c137829 | 87 | |
va009039 | 0:b0f04c137829 | 88 | void uvc::SetPayload(int payload) |
va009039 | 0:b0f04c137829 | 89 | { |
va009039 | 0:b0f04c137829 | 90 | DBG_ASSERT(payload == PAYLOAD_MJPEG || payload == PAYLOAD_YUY2); |
va009039 | 0:b0f04c137829 | 91 | m_payload = payload; |
va009039 | 0:b0f04c137829 | 92 | } |
va009039 | 0:b0f04c137829 | 93 | |
va009039 | 0:b0f04c137829 | 94 | void uvc::poll() |
va009039 | 0:b0f04c137829 | 95 | { |
va009039 | 0:b0f04c137829 | 96 | isochronous(); |
va009039 | 0:b0f04c137829 | 97 | } |
va009039 | 0:b0f04c137829 | 98 | |
va009039 | 0:b0f04c137829 | 99 | int uvc::_init() |
va009039 | 0:b0f04c137829 | 100 | { |
va009039 | 0:b0f04c137829 | 101 | m_init = true; |
va009039 | 0:b0f04c137829 | 102 | UsbErr rc; |
va009039 | 0:b0f04c137829 | 103 | for(int i = 0; i < 2; i++) { |
va009039 | 0:b0f04c137829 | 104 | m_pDev = m_pHost->getDeviceByClass(CLASS_VIDEO, m_cam); // UVC |
va009039 | 0:b0f04c137829 | 105 | if (m_pDev || i > 0) { |
va009039 | 0:b0f04c137829 | 106 | break; |
va009039 | 0:b0f04c137829 | 107 | } |
va009039 | 0:b0f04c137829 | 108 | rc = Usb_poll(); |
va009039 | 0:b0f04c137829 | 109 | if (rc == USBERR_PROCESSING) { |
va009039 | 0:b0f04c137829 | 110 | VERBOSE("%p USBERR_PROCESSING\n", this); |
va009039 | 0:b0f04c137829 | 111 | return -1; |
va009039 | 0:b0f04c137829 | 112 | } |
va009039 | 0:b0f04c137829 | 113 | } |
va009039 | 0:b0f04c137829 | 114 | DBG("m_pDev=%p\n", m_pDev); |
va009039 | 0:b0f04c137829 | 115 | if (!m_pDev) { |
va009039 | 0:b0f04c137829 | 116 | VERBOSE("%p UVC CAMERA(%d) NOT FOUND\n", this, m_cam); |
va009039 | 0:b0f04c137829 | 117 | return -1; |
va009039 | 0:b0f04c137829 | 118 | } |
va009039 | 0:b0f04c137829 | 119 | DBG_ASSERT(m_pDev); |
va009039 | 0:b0f04c137829 | 120 | |
va009039 | 0:b0f04c137829 | 121 | struct stcamcfg cfg; |
va009039 | 0:b0f04c137829 | 122 | for(int i = 0; ; i++) { |
va009039 | 0:b0f04c137829 | 123 | cfg = stcamcfg_table[i]; |
va009039 | 0:b0f04c137829 | 124 | if (cfg.idVender == 0x0000) { |
va009039 | 0:b0f04c137829 | 125 | DBG("not cam config\n"); |
va009039 | 0:b0f04c137829 | 126 | DBG("vid: %04X\n", m_pDev->getVid()); |
va009039 | 0:b0f04c137829 | 127 | DBG("pid: %04X\n", m_pDev->getPid()); |
va009039 | 0:b0f04c137829 | 128 | break; |
va009039 | 0:b0f04c137829 | 129 | } |
va009039 | 0:b0f04c137829 | 130 | if (cfg.idVender == m_pDev->getVid() && cfg.idProduct == m_pDev->getPid()) { |
va009039 | 0:b0f04c137829 | 131 | DBG_ASSERT(cfg.name); |
va009039 | 0:b0f04c137829 | 132 | DBG("found %s\n", cfg.name); |
va009039 | 0:b0f04c137829 | 133 | break; |
va009039 | 0:b0f04c137829 | 134 | } |
va009039 | 0:b0f04c137829 | 135 | } |
va009039 | 0:b0f04c137829 | 136 | |
va009039 | 0:b0f04c137829 | 137 | if (m_width) { |
va009039 | 0:b0f04c137829 | 138 | cfg.width = m_width; |
va009039 | 0:b0f04c137829 | 139 | } |
va009039 | 0:b0f04c137829 | 140 | if (m_height) { |
va009039 | 0:b0f04c137829 | 141 | cfg.height = m_height; |
va009039 | 0:b0f04c137829 | 142 | } |
va009039 | 0:b0f04c137829 | 143 | if (m_payload != PAYLOAD_UNDEF) { |
va009039 | 0:b0f04c137829 | 144 | cfg.payload = m_payload; |
va009039 | 0:b0f04c137829 | 145 | } |
va009039 | 0:b0f04c137829 | 146 | if (m_FormatIndex) { |
va009039 | 0:b0f04c137829 | 147 | cfg.FormatIndex = m_FormatIndex; |
va009039 | 0:b0f04c137829 | 148 | } |
va009039 | 0:b0f04c137829 | 149 | if (m_FrameIndex) { |
va009039 | 0:b0f04c137829 | 150 | cfg.FrameIndex = m_FrameIndex; |
va009039 | 0:b0f04c137829 | 151 | } |
va009039 | 0:b0f04c137829 | 152 | if (m_FrameInterval) { |
va009039 | 0:b0f04c137829 | 153 | cfg.dwFrameInterval = m_FrameInterval; |
va009039 | 0:b0f04c137829 | 154 | } |
va009039 | 0:b0f04c137829 | 155 | if (m_PacketSize) { |
va009039 | 0:b0f04c137829 | 156 | cfg.wMaxPacketSize = m_PacketSize; |
va009039 | 0:b0f04c137829 | 157 | } |
va009039 | 0:b0f04c137829 | 158 | |
va009039 | 0:b0f04c137829 | 159 | _config(&cfg); |
va009039 | 0:b0f04c137829 | 160 | |
va009039 | 0:b0f04c137829 | 161 | if (cfg.FormatIndex == UNDEF_VAL) { |
va009039 | 0:b0f04c137829 | 162 | if (cfg.payload == PAYLOAD_MJPEG) { |
va009039 | 0:b0f04c137829 | 163 | VERBOSE("MJPG(Motion JPEG) FORMAT NOT FOUND\n"); |
va009039 | 0:b0f04c137829 | 164 | } else if (cfg.payload == PAYLOAD_YUY2) { |
va009039 | 0:b0f04c137829 | 165 | VERBOSE("YUY2 FORMAT NOT FOUND\n"); |
va009039 | 0:b0f04c137829 | 166 | } else { |
va009039 | 0:b0f04c137829 | 167 | VERBOSE("??? FORMAT NOT FOUND\n"); |
va009039 | 0:b0f04c137829 | 168 | } |
va009039 | 0:b0f04c137829 | 169 | return -1; |
va009039 | 0:b0f04c137829 | 170 | } |
va009039 | 0:b0f04c137829 | 171 | |
va009039 | 0:b0f04c137829 | 172 | if (cfg.bInterface == UNDEF_VAL) { |
va009039 | 0:b0f04c137829 | 173 | VERBOSE("PacketSize(%d) CONFIG ERROR\n", cfg.wMaxPacketSize); |
va009039 | 0:b0f04c137829 | 174 | return -1; |
va009039 | 0:b0f04c137829 | 175 | } |
va009039 | 0:b0f04c137829 | 176 | |
va009039 | 0:b0f04c137829 | 177 | if (cfg.iso_FrameCount == 0) { |
va009039 | 0:b0f04c137829 | 178 | int c = usb_bp_size() / cfg.wMaxPacketSize; |
va009039 | 0:b0f04c137829 | 179 | if (c > 8) { |
va009039 | 0:b0f04c137829 | 180 | c = 8; |
va009039 | 0:b0f04c137829 | 181 | } |
va009039 | 0:b0f04c137829 | 182 | cfg.iso_FrameCount = c; |
va009039 | 0:b0f04c137829 | 183 | } |
va009039 | 0:b0f04c137829 | 184 | DBG_ASSERT(cfg.iso_FrameCount >= 1); |
va009039 | 0:b0f04c137829 | 185 | DBG_ASSERT(cfg.iso_FrameCount <= 8); |
va009039 | 0:b0f04c137829 | 186 | DBG_ASSERT((cfg.iso_FrameCount * cfg.wMaxPacketSize) <= usb_bp_size()); |
va009039 | 0:b0f04c137829 | 187 | if (cfg.iso_itdCount == 0) { |
va009039 | 0:b0f04c137829 | 188 | cfg.iso_itdCount = 3; |
va009039 | 0:b0f04c137829 | 189 | } |
va009039 | 0:b0f04c137829 | 190 | DBG_ASSERT(cfg.iso_itdCount >= 1); |
va009039 | 0:b0f04c137829 | 191 | DBG("cfg.wMaxPacketSize=%d\n", cfg.wMaxPacketSize); |
va009039 | 0:b0f04c137829 | 192 | DBG("cfg.iso_FrameCount=%d\n", cfg.iso_FrameCount); |
va009039 | 0:b0f04c137829 | 193 | DBG("cfg.iso_itdCount=%d\n", cfg.iso_itdCount); |
va009039 | 0:b0f04c137829 | 194 | DBG_ASSERT(cfg.iso_FrameCount >= 1 && cfg.iso_FrameCount <= 8); |
va009039 | 0:b0f04c137829 | 195 | //m_pEpIntIn = new UsbEndpoint(m_pDev, 0x83, true, USB_INT, 16); |
va009039 | 0:b0f04c137829 | 196 | //DBG_ASSERT(m_pEpIntIn); |
va009039 | 0:b0f04c137829 | 197 | |
va009039 | 0:b0f04c137829 | 198 | DBG_ASSERT(cfg.bEndpointAddress & 0x80); |
va009039 | 0:b0f04c137829 | 199 | DBG_ASSERT(cfg.wMaxPacketSize >= 128); |
va009039 | 0:b0f04c137829 | 200 | DBG_ASSERT(cfg.wMaxPacketSize <= 1020); |
va009039 | 0:b0f04c137829 | 201 | m_PacketSize = cfg.wMaxPacketSize; |
va009039 | 0:b0f04c137829 | 202 | |
va009039 | 0:b0f04c137829 | 203 | DBG_ASSERT(m_PacketSize); |
va009039 | 0:b0f04c137829 | 204 | m_pEpIsoIn = new UsbEndpoint(m_pDev, cfg.bEndpointAddress, true, USB_ISO, m_PacketSize); |
va009039 | 0:b0f04c137829 | 205 | DBG_ASSERT(m_pEpIsoIn); |
va009039 | 0:b0f04c137829 | 206 | |
va009039 | 0:b0f04c137829 | 207 | DBG_ASSERT(cfg.FormatIndex >= 1); |
va009039 | 0:b0f04c137829 | 208 | DBG_ASSERT(cfg.FormatIndex <= 2); |
va009039 | 0:b0f04c137829 | 209 | DBG_ASSERT(cfg.FrameIndex >= 1); |
va009039 | 2:812d604caad4 | 210 | DBG_ASSERT(cfg.FrameIndex <= 12); |
va009039 | 0:b0f04c137829 | 211 | DBG_ASSERT(cfg.dwFrameInterval <= 10000000); |
va009039 | 0:b0f04c137829 | 212 | DBG_ASSERT(cfg.dwFrameInterval >= 333333); |
va009039 | 0:b0f04c137829 | 213 | |
va009039 | 0:b0f04c137829 | 214 | probe_commit_control(&cfg); |
va009039 | 0:b0f04c137829 | 215 | |
va009039 | 0:b0f04c137829 | 216 | DBG("cfg.bInterface = %d, cfg.bAlternate = %d\n", cfg.bInterface, cfg.bAlternate); |
va009039 | 0:b0f04c137829 | 217 | //USBH_SET_INTERFACE(1, 1); // alt=1 size=128 |
va009039 | 0:b0f04c137829 | 218 | DBG_ASSERT(cfg.bInterface >= 1); |
va009039 | 0:b0f04c137829 | 219 | DBG_ASSERT(cfg.bAlternate >= 1); |
va009039 | 0:b0f04c137829 | 220 | DBG_ASSERT(cfg.bAlternate <= 7); |
va009039 | 0:b0f04c137829 | 221 | rc = m_pDev->SetInterfaceAlternate(cfg.bInterface, cfg.bAlternate); |
va009039 | 0:b0f04c137829 | 222 | DBG_ASSERT(rc == USBERR_OK); |
va009039 | 0:b0f04c137829 | 223 | |
va009039 | 0:b0f04c137829 | 224 | DBG_ASSERT(cfg.iso_FrameCount >= 1); |
va009039 | 0:b0f04c137829 | 225 | DBG_ASSERT(cfg.iso_FrameCount <= 8); |
va009039 | 0:b0f04c137829 | 226 | m_FrameCount = cfg.iso_FrameCount; |
va009039 | 0:b0f04c137829 | 227 | |
va009039 | 0:b0f04c137829 | 228 | DBG_ASSERT(cfg.iso_itdCount >= 1); |
va009039 | 0:b0f04c137829 | 229 | DBG_ASSERT(cfg.iso_itdCount <= 8); |
va009039 | 0:b0f04c137829 | 230 | m_itdCount = cfg.iso_itdCount; |
va009039 | 0:b0f04c137829 | 231 | |
va009039 | 0:b0f04c137829 | 232 | LPC_USB->HcControl |= OR_CONTROL_PLE; // PeriodicListEnable |
va009039 | 0:b0f04c137829 | 233 | LPC_USB->HcControl |= OR_CONTROL_IE; // IsochronousEnable |
va009039 | 0:b0f04c137829 | 234 | |
va009039 | 0:b0f04c137829 | 235 | m_connect = true; |
va009039 | 0:b0f04c137829 | 236 | return 0; |
va009039 | 0:b0f04c137829 | 237 | } |
va009039 | 0:b0f04c137829 | 238 | |
va009039 | 0:b0f04c137829 | 239 | static void dump_param(uint8_t* buf) |
va009039 | 0:b0f04c137829 | 240 | { |
va009039 | 0:b0f04c137829 | 241 | VERBOSE("Hint: %04x\n", LE16(buf+0)); |
va009039 | 0:b0f04c137829 | 242 | VERBOSE("FormatIndex: %d\n", buf[2]); |
va009039 | 0:b0f04c137829 | 243 | VERBOSE("FrameIndex: %d\n", buf[3]); |
va009039 | 0:b0f04c137829 | 244 | VERBOSE("FrameInterval: %d\n", LE32(buf+4)); |
va009039 | 0:b0f04c137829 | 245 | VERBOSE("KeyFrameRate: %d\n", LE16(buf+8)); |
va009039 | 0:b0f04c137829 | 246 | VERBOSE("PFrameRate: %d\n", LE16(buf+10)); |
va009039 | 0:b0f04c137829 | 247 | VERBOSE("CompQuality: %d\n", LE16(buf+12)); |
va009039 | 0:b0f04c137829 | 248 | VERBOSE("CompWindowSize: %d\n", LE16(buf+14)); |
va009039 | 0:b0f04c137829 | 249 | VERBOSE("Delay: %d\n", LE16(buf+16)); |
va009039 | 0:b0f04c137829 | 250 | VERBOSE("MaxVideoFrameSize: %d\n", LE32(buf+18)); |
va009039 | 0:b0f04c137829 | 251 | VERBOSE("MaxPayloadTransferSize: %d\n", LE32(buf+22)); |
va009039 | 0:b0f04c137829 | 252 | } |
va009039 | 0:b0f04c137829 | 253 | |
va009039 | 0:b0f04c137829 | 254 | void uvc::probe_commit_control(struct stcamcfg* cfg) |
va009039 | 0:b0f04c137829 | 255 | { |
va009039 | 0:b0f04c137829 | 256 | DBG_ASSERT(cfg); |
va009039 | 0:b0f04c137829 | 257 | uint8_t param[34]; |
va009039 | 0:b0f04c137829 | 258 | uint8_t temp[34]; |
va009039 | 0:b0f04c137829 | 259 | |
va009039 | 0:b0f04c137829 | 260 | int param_len = 34; |
va009039 | 0:b0f04c137829 | 261 | DBG_ASSERT(cfg->bcdUVC >= 0x0100); |
va009039 | 0:b0f04c137829 | 262 | if (cfg->bcdUVC == 0x0100) { // UVC ver. 1.0 |
va009039 | 0:b0f04c137829 | 263 | param_len = 26; |
va009039 | 0:b0f04c137829 | 264 | } |
va009039 | 0:b0f04c137829 | 265 | |
va009039 | 0:b0f04c137829 | 266 | UsbErr rc; |
va009039 | 0:b0f04c137829 | 267 | rc = Control(GET_INFO, VS_PROBE_CONTROL, 1, param, 1); |
va009039 | 0:b0f04c137829 | 268 | DBG_ASSERT(rc == USBERR_OK); |
va009039 | 0:b0f04c137829 | 269 | DBG_BYTES("GET_INFO Probe ", param, 1); |
va009039 | 0:b0f04c137829 | 270 | |
va009039 | 0:b0f04c137829 | 271 | rc = Control(GET_DEF, VS_PROBE_CONTROL, 1, temp, param_len); |
va009039 | 0:b0f04c137829 | 272 | DBG_ASSERT(rc == USBERR_OK); |
va009039 | 0:b0f04c137829 | 273 | DBG_BYTES("GET_DEF Probe ", temp, param_len); |
va009039 | 0:b0f04c137829 | 274 | dump_param(temp); |
va009039 | 0:b0f04c137829 | 275 | |
va009039 | 0:b0f04c137829 | 276 | rc = Control(GET_MIN, VS_PROBE_CONTROL, 1, temp, param_len); |
va009039 | 0:b0f04c137829 | 277 | DBG_ASSERT(rc == USBERR_OK); |
va009039 | 0:b0f04c137829 | 278 | DBG_BYTES("GET_MIN Probe ", temp, param_len); |
va009039 | 0:b0f04c137829 | 279 | dump_param(temp); |
va009039 | 0:b0f04c137829 | 280 | |
va009039 | 0:b0f04c137829 | 281 | rc = Control(GET_MAX, VS_PROBE_CONTROL, 1, temp, param_len); |
va009039 | 0:b0f04c137829 | 282 | DBG_ASSERT(rc == USBERR_OK); |
va009039 | 0:b0f04c137829 | 283 | DBG_BYTES("GET_MAX Probe ", temp, param_len); |
va009039 | 0:b0f04c137829 | 284 | dump_param(temp); |
va009039 | 0:b0f04c137829 | 285 | |
va009039 | 0:b0f04c137829 | 286 | rc = Control(GET_CUR, VS_PROBE_CONTROL, 1, temp, param_len); |
va009039 | 0:b0f04c137829 | 287 | DBG_ASSERT(rc == USBERR_OK); |
va009039 | 0:b0f04c137829 | 288 | DBG_BYTES("GET_CUR Probe ", temp, param_len); |
va009039 | 0:b0f04c137829 | 289 | dump_param(temp); |
va009039 | 0:b0f04c137829 | 290 | |
va009039 | 0:b0f04c137829 | 291 | memset(param, 0x00, param_len); |
va009039 | 0:b0f04c137829 | 292 | param[2] = cfg->FormatIndex; |
va009039 | 0:b0f04c137829 | 293 | param[3] = cfg->FrameIndex; // 160x120 |
va009039 | 0:b0f04c137829 | 294 | LE32(cfg->dwFrameInterval, param+4); // Frame Interval |
va009039 | 0:b0f04c137829 | 295 | |
va009039 | 0:b0f04c137829 | 296 | DBG_BYTES("SET_CUR Probe ", param, param_len); |
va009039 | 0:b0f04c137829 | 297 | rc = Control(SET_CUR, VS_PROBE_CONTROL, 1, param, param_len); |
va009039 | 0:b0f04c137829 | 298 | DBG_ASSERT(rc == USBERR_OK); |
va009039 | 0:b0f04c137829 | 299 | |
va009039 | 0:b0f04c137829 | 300 | rc = Control(GET_CUR, VS_PROBE_CONTROL, 1, temp, param_len); |
va009039 | 0:b0f04c137829 | 301 | DBG_ASSERT(rc == USBERR_OK); |
va009039 | 0:b0f04c137829 | 302 | DBG_BYTES("GET_CUR Probe ", temp, param_len); |
va009039 | 0:b0f04c137829 | 303 | |
va009039 | 0:b0f04c137829 | 304 | rc = Control(GET_INFO, VS_COMMIT_CONTROL, 1, temp, param_len); |
va009039 | 0:b0f04c137829 | 305 | DBG_ASSERT(rc == USBERR_OK); |
va009039 | 0:b0f04c137829 | 306 | DBG_BYTES("GET_INFO Commit", temp, 1); |
va009039 | 0:b0f04c137829 | 307 | |
va009039 | 0:b0f04c137829 | 308 | rc = Control(GET_CUR, VS_COMMIT_CONTROL, 1, temp, param_len); |
va009039 | 0:b0f04c137829 | 309 | DBG_ASSERT(rc == USBERR_OK); |
va009039 | 0:b0f04c137829 | 310 | DBG_BYTES("GET_CUR Commit", temp, param_len); |
va009039 | 0:b0f04c137829 | 311 | dump_param(temp); |
va009039 | 0:b0f04c137829 | 312 | |
va009039 | 0:b0f04c137829 | 313 | DBG_BYTES("SET_CUR Commit", param, param_len); |
va009039 | 0:b0f04c137829 | 314 | dump_param(param); |
va009039 | 0:b0f04c137829 | 315 | rc = Control(SET_CUR, VS_COMMIT_CONTROL, 1, param, param_len); |
va009039 | 0:b0f04c137829 | 316 | if (rc != USBERR_OK) { |
va009039 | 0:b0f04c137829 | 317 | VERBOSE("Error SET_CUR VS_COMMIT_CONTROL\n"); |
va009039 | 0:b0f04c137829 | 318 | } |
va009039 | 0:b0f04c137829 | 319 | DBG_ASSERT(rc == USBERR_OK); |
va009039 | 0:b0f04c137829 | 320 | |
va009039 | 0:b0f04c137829 | 321 | rc = Control(GET_CUR, VS_COMMIT_CONTROL, 1, temp, param_len); |
va009039 | 0:b0f04c137829 | 322 | DBG_ASSERT(rc == USBERR_OK); |
va009039 | 0:b0f04c137829 | 323 | DBG_BYTES("GET_CUR Commit", temp, param_len); |
va009039 | 0:b0f04c137829 | 324 | dump_param(temp); |
va009039 | 0:b0f04c137829 | 325 | } |