comparison Output/pjrcUSB/arm/usb_dev.c @ 302:ac842066568a

Adding additional case statements for SET_FEATURE and CLEAR_FEATURE - Ignoring (which is done by default) - Device, Interface and Endpoint variants
author Jacob Alexander <haata@kiibohd.com>
date Sat, 07 Mar 2015 00:50:42 -0800
parents c8605539efef
children 05a09eda53fb 4f47971c45c2
comparison
equal deleted inserted replaced
301:c8605539efef 302:ac842066568a
298 reply_buffer[1] = 0; 298 reply_buffer[1] = 0;
299 datalen = 2; 299 datalen = 2;
300 data = reply_buffer; 300 data = reply_buffer;
301 break; 301 break;
302 case 0x0082: // GET_STATUS (endpoint) 302 case 0x0082: // GET_STATUS (endpoint)
303 if (setup.wIndex > NUM_ENDPOINTS) 303 if ( setup.wIndex > NUM_ENDPOINTS )
304 { 304 {
305 // TODO: do we need to handle IN vs OUT here? 305 // TODO: do we need to handle IN vs OUT here?
306 endpoint0_stall(); 306 endpoint0_stall();
307 return; 307 return;
308 } 308 }
311 if ( *(uint8_t *)(&USB0_ENDPT0 + setup.wIndex * 4) & 0x02 ) 311 if ( *(uint8_t *)(&USB0_ENDPT0 + setup.wIndex * 4) & 0x02 )
312 reply_buffer[0] = 1; 312 reply_buffer[0] = 1;
313 data = reply_buffer; 313 data = reply_buffer;
314 datalen = 2; 314 datalen = 2;
315 break; 315 break;
316 case 0x0102: // CLEAR_FEATURE (endpoint) 316 case 0x0100: // CLEAR_FEATURE (device)
317 case 0x0101: // CLEAR_FEATURE (interface)
318 // TODO: Currently ignoring, perhaps useful? -HaaTa
319 endpoint0_stall();
320 return;
321 case 0x0102: // CLEAR_FEATURE (interface)
317 i = setup.wIndex & 0x7F; 322 i = setup.wIndex & 0x7F;
318 if ( i > NUM_ENDPOINTS || setup.wValue != 0 ) 323 if ( i > NUM_ENDPOINTS || setup.wValue != 0 )
319 { 324 {
320 endpoint0_stall(); 325 endpoint0_stall();
321 return; 326 return;
324 // TODO: do we need to clear the data toggle here? 329 // TODO: do we need to clear the data toggle here?
325 //break; 330 //break;
326 331
327 // FIXME: Clearing causes keyboard to freeze, likely an invalid clear 332 // FIXME: Clearing causes keyboard to freeze, likely an invalid clear
328 // XXX: Ignoring seems to work, though this may not be the ideal behaviour -HaaTa 333 // XXX: Ignoring seems to work, though this may not be the ideal behaviour -HaaTa
334 endpoint0_stall();
335 return;
336 case 0x0300: // SET_FEATURE (device)
337 case 0x0301: // SET_FEATURE (interface)
338 // TODO: Currently ignoring, perhaps useful? -HaaTa
329 endpoint0_stall(); 339 endpoint0_stall();
330 return; 340 return;
331 case 0x0302: // SET_FEATURE (endpoint) 341 case 0x0302: // SET_FEATURE (endpoint)
332 i = setup.wIndex & 0x7F; 342 i = setup.wIndex & 0x7F;
333 if ( i > NUM_ENDPOINTS || setup.wValue != 0 ) 343 if ( i > NUM_ENDPOINTS || setup.wValue != 0 )