Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 1 file changed
  • 0 comments
  • 1 contributor

Showing 1 changed file with 10 additions and 3 deletions. Show diff stats Hide diff stats

  1. 13  softusb-input/main.c
13  softusb-input/main.c
@@ -32,6 +32,7 @@ enum {
32 32
 	USB_PID_SETUP	= 0x2d,
33 33
 	USB_PID_DATA0	= 0xc3,
34 34
 	USB_PID_DATA1	= 0x4b,
  35
+	USB_PID_SOF	= 0xa5,
35 36
 	USB_PID_ACK	= 0xd2,
36 37
 	USB_PID_NAK	= 0x5a,
37 38
 };
@@ -100,7 +101,7 @@ static unsigned char usb_rx(unsigned char *buf, unsigned char maxlen)
100 101
 	unsigned char i;
101 102
 
102 103
 	i = 0;
103  
-	timeout = 0xfff;
  104
+	timeout = 0x1ff;
104 105
 	while(!rio8(SIE_RX_PENDING)) {
105 106
 		if(timeout-- == 0) {
106 107
 			print_string(transfer_start);
@@ -114,7 +115,7 @@ static unsigned char usb_rx(unsigned char *buf, unsigned char maxlen)
114 115
 		}
115 116
 	}
116 117
 	while(1) {
117  
-		timeout = 0xfff;
  118
+		timeout = 0x1ff;
118 119
 		while(!rio8(SIE_RX_PENDING)) {
119 120
 			if(rio8(SIE_RX_ERROR)) {
120 121
 				print_string(bitstuff_error);
@@ -420,7 +421,7 @@ static char validate_configuration_descriptor(unsigned char *descriptor,
420 421
 static const char retry_exceed[] PROGMEM = "Retry count exceeded, disabling device.\n";
421 422
 static void check_retry(struct port_status *p)
422 423
 {
423  
-	if(p->retry_count++ > 20) {
  424
+	if(p->retry_count++ > 4) {
424 425
 		print_string(retry_exceed);
425 426
 		p->state = PORT_STATE_UNSUPPORTED;
426 427
 	}
@@ -445,6 +446,12 @@ static void port_service(struct port_status *p, char name)
445 446
 		wio8(SIE_TX_LOW_SPEED, 0);
446 447
 	else
447 448
 		wio8(SIE_TX_LOW_SPEED, 1);
  449
+	if((p->full_speed) && (p->state > PORT_STATE_BUS_RESET)) {
  450
+		/* send SOF */
  451
+		unsigned char usb_buffer[3];
  452
+		make_usb_token(USB_PID_SOF, frame_nr, usb_buffer);
  453
+		usb_tx(usb_buffer, 3);
  454
+	}
448 455
 	switch(p->state) {
449 456
 		case PORT_STATE_DISCONNECTED: {
450 457
 			char linestat;

No commit comments for this range

Something went wrong with that request. Please try again.