comparison Output/pjrcUSB/arm/usb_dev.c @ 346:1beec5f17e64

Revert "Merge pull request #27 from smasher816/wakeup-devel" This reverts commit 622ea5d85f94be4b1694fdf08e30fa76eeb18fe4, reversing changes made to c21439cb48daec7514da4250c41962205fa96624.
author Jacob Alexander <haata@kiibohd.com>
date Tue, 23 Jun 2015 08:00:16 -0700
parents f7b14e25ca5b
children 136e47478441
comparison
equal deleted inserted replaced
345:2bcf6800b851 346:1beec5f17e64
165 volatile uint8_t usb_configuration = 0; 165 volatile uint8_t usb_configuration = 0;
166 volatile uint8_t usb_reboot_timer = 0; 166 volatile uint8_t usb_reboot_timer = 0;
167 167
168 static uint8_t reply_buffer[8]; 168 static uint8_t reply_buffer[8];
169 169
170 volatile uint8_t remote_wakeup_enabled = 0;
171 170
172 171
173 // ----- Functions ----- 172 // ----- Functions -----
174 173
175 static void endpoint0_stall() 174 static void endpoint0_stall()
293 reply_buffer[0] = usb_configuration; 292 reply_buffer[0] = usb_configuration;
294 datalen = 1; 293 datalen = 1;
295 data = reply_buffer; 294 data = reply_buffer;
296 break; 295 break;
297 case 0x0080: // GET_STATUS (device) 296 case 0x0080: // GET_STATUS (device)
298 //I think this is the corrent endianess 297 reply_buffer[0] = 0;
299 reply_buffer[0] = (remote_wakeup_enabled)<<1;
300 reply_buffer[1] = 0; 298 reply_buffer[1] = 0;
301 datalen = 2; 299 datalen = 2;
302 data = reply_buffer; 300 data = reply_buffer;
303 break; 301 break;
304 case 0x0082: // GET_STATUS (endpoint) 302 case 0x0082: // GET_STATUS (endpoint)
314 reply_buffer[0] = 1; 312 reply_buffer[0] = 1;
315 data = reply_buffer; 313 data = reply_buffer;
316 datalen = 2; 314 datalen = 2;
317 break; 315 break;
318 case 0x0100: // CLEAR_FEATURE (device) 316 case 0x0100: // CLEAR_FEATURE (device)
319 //Disable DEVICE_REMOTE_WAKEUP feature
320 if (setup.wValue == 0x01) {
321 remote_wakeup_enabled = 0;
322 }
323 break;
324 case 0x0101: // CLEAR_FEATURE (interface) 317 case 0x0101: // CLEAR_FEATURE (interface)
325 // TODO: Currently ignoring, perhaps useful? -HaaTa 318 // TODO: Currently ignoring, perhaps useful? -HaaTa
326 endpoint0_stall(); 319 endpoint0_stall();
327 return; 320 return;
328 case 0x0102: // CLEAR_FEATURE (interface) 321 case 0x0102: // CLEAR_FEATURE (interface)
339 // FIXME: Clearing causes keyboard to freeze, likely an invalid clear 332 // FIXME: Clearing causes keyboard to freeze, likely an invalid clear
340 // 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
341 endpoint0_stall(); 334 endpoint0_stall();
342 return; 335 return;
343 case 0x0300: // SET_FEATURE (device) 336 case 0x0300: // SET_FEATURE (device)
344 //Enable DEVICE_REMOTE_WAKEUP feature
345 if (setup.wValue == 0x01) {
346 remote_wakeup_enabled = 1;
347 }
348 break;
349 case 0x0301: // SET_FEATURE (interface) 337 case 0x0301: // SET_FEATURE (interface)
350 // TODO: Currently ignoring, perhaps useful? -HaaTa 338 // TODO: Currently ignoring, perhaps useful? -HaaTa
351 endpoint0_stall(); 339 endpoint0_stall();
352 return; 340 return;
353 case 0x0302: // SET_FEATURE (endpoint) 341 case 0x0302: // SET_FEATURE (endpoint)
1118 if ( (status & USB_ISTAT_SLEEP /* 10 */ ) ) 1106 if ( (status & USB_ISTAT_SLEEP /* 10 */ ) )
1119 { 1107 {
1120 //serial_print("sleep\n"); 1108 //serial_print("sleep\n");
1121 USB0_ISTAT = USB_ISTAT_SLEEP; 1109 USB0_ISTAT = USB_ISTAT_SLEEP;
1122 } 1110 }
1123
1124 if ( (status & USB_ISTAT_RESUME /* 20 */ ) ) {
1125 //serial_print("resume\n");
1126 USB0_ISTAT = USB_ISTAT_RESUME;
1127 }
1128 } 1111 }
1129 1112
1130 1113
1131 1114
1132 uint8_t usb_init() 1115 uint8_t usb_init()