Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

softusb: move (still hard-coded) device address to #define

  • Loading branch information...
commit efd771ad9b4228c409f7a5c75b322b0fe15c9c0b 1 parent 00c097c
Werner Almesberger wpwrak authored sbourdeauducq committed

Showing 1 changed file with 7 additions and 5 deletions. Show diff stats Hide diff stats

  1. +7 5 softusb-input/main.c
12 softusb-input/main.c
@@ -86,6 +86,8 @@ static struct port_status port_b;
86 86 static unsigned int frame_nr;
87 87
88 88 #define ADDR_EP(addr, ep) ((addr) | (ep) << 7)
  89 +#define ADDR 1
  90 +
89 91
90 92 static void make_usb_token(unsigned char pid, unsigned int elevenbits, unsigned char *out)
91 93 {
@@ -410,7 +412,7 @@ static void poll(struct ep_status *ep, char keyboard)
410 412 unsigned char m;
411 413 char i;
412 414
413   - len = usb_in(ADDR_EP(1, ep->ep), ep->expected_data, usb_buffer, 11);
  415 + len = usb_in(ADDR_EP(ADDR, ep->ep), ep->expected_data, usb_buffer, 11);
414 416 if(len <= 0)
415 417 return;
416 418 ep->expected_data = toggle(ep->expected_data);
@@ -583,7 +585,7 @@ static void port_service(struct port_status *p, char name)
583 585
584 586 packet.bmRequestType = 0x00;
585 587 packet.bRequest = 0x05;
586   - packet.wValue[0] = 0x01;
  588 + packet.wValue[0] = ADDR;
587 589 packet.wValue[1] = 0x00;
588 590 packet.wIndex[0] = 0x00;
589 591 packet.wIndex[1] = 0x00;
@@ -610,7 +612,7 @@ static void port_service(struct port_status *p, char name)
610 612 packet.wLength[0] = 18;
611 613 packet.wLength[1] = 0x00;
612 614
613   - if(control_transfer(0x01, &packet, 0, device_descriptor, 18) >= 0) {
  615 + if(control_transfer(ADDR, &packet, 0, device_descriptor, 18) >= 0) {
614 616 p->retry_count = 0;
615 617 print_string(vid);
616 618 print_hex(device_descriptor[9]);
@@ -645,7 +647,7 @@ static void port_service(struct port_status *p, char name)
645 647 packet.wLength[0] = 127;
646 648 packet.wLength[1] = 0x00;
647 649
648   - len = control_transfer(0x01, &packet, 0, configuration_descriptor, 127);
  650 + len = control_transfer(ADDR, &packet, 0, configuration_descriptor, 127);
649 651 if(len >= 0) {
650 652 p->retry_count = 0;
651 653 if(!validate_configuration_descriptor(
@@ -679,7 +681,7 @@ static void port_service(struct port_status *p, char name)
679 681 packet.wLength[0] = 0x00;
680 682 packet.wLength[1] = 0x00;
681 683
682   - if(control_transfer(0x01, &packet, 1, NULL, 0) == 0) {
  684 + if(control_transfer(ADDR, &packet, 1, NULL, 0) == 0) {
683 685 p->retry_count = 0;
684 686 p->state = PORT_STATE_RUNNING;
685 687 }

0 comments on commit efd771a

Please sign in to comment.
Something went wrong with that request. Please try again.