Skip to content

Conversation

@mithro
Copy link

@mithro mithro commented Apr 28, 2014

On our Atlys board, we flash the Cypress with "fx2loader -v 1d50:602b HDMI2USB-firmware-prebuilt/hdmi2usb.hex ram" and then uvcvideo and cdc-acm drivers connect to the new endpoints.

This patch lets us use "flcli -v 1d50:602b:9994 -i fb9a:fb9a" to return the Cypress into programming mode.

[94023.794451] cdc_acm 2-1.1:1.2: ttyACM0: USB ACM device
[94026.571620] usb 2-1.1: USB disconnect, device number 19
[94028.051519] usb 2-1.1: new high-speed USB device number 20 using ehci-pci
[94028.144983] usb 2-1.1: New USB device found, idVendor=1d50, idProduct=602b
[94028.144995] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[94028.145002] usb 2-1.1: Product: FPGALink/FX2 20140311
[94028.145007] usb 2-1.1: Manufacturer: MakeStuff
[95015.404214] usb 2-1.1: USB disconnect, device number 20
[95017.138867] usb 2-1.1: new high-speed USB device number 21 using ehci-pci
[95017.231537] usb 2-1.1: config 1 interface 2 altsetting 0 endpoint 0x81 has an invalid bInterval 17, changing to 8
[95017.232517] usb 2-1.1: New USB device found, idVendor=fb9a, idProduct=fb9a
[95017.232527] usb 2-1.1: New USB device strings: Mfr=2, Product=1, SerialNumber=1
[95017.232533] usb 2-1.1: Product: HDMI2USB
[95017.232538] usb 2-1.1: Manufacturer: JANI
[95017.232542] usb 2-1.1: SerialNumber: HDMI2USB
[95017.233332] uvcvideo: Found UVC 1.00 device HDMI2USB (fb9a:fb9a)
[95017.233558] uvcvideo: UVC non compliance - GET_DEF(PROBE) not supported. Enabling workaround.
[95017.234742] cdc_acm 2-1.1:1.2: This device cannot do calls on its own. It is not a modem.
[95017.234852] cdc_acm 2-1.1:1.2: ttyACM0: USB ACM device
[95023.085273] usb 2-1.1: USB disconnect, device number 21
[95024.564253] usb 2-1.1: new high-speed USB device number 22 using ehci-pci
[95024.657215] usb 2-1.1: New USB device found, idVendor=1d50, idProduct=602b
[95024.657228] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[95024.657234] usb 2-1.1: Product: FPGALink/FX2 20140311
[95024.657239] usb 2-1.1: Manufacturer: MakeStuff

@makestuff
Copy link
Owner

This looks good in principle. A couple of minor problems though:

  1. You're using a local "int i" in a for loop, which will break the Microsoft compiler. There's already a suitable "i" variable that's used earlier, so you can just re-use that.
  2. Typo alert: does "detact" mean "detect" or "detach"?
  3. Formatting - I use spaces either side of the parens in "for", "while", "if", etc, so "if ( libusb_kernel_driver_active(retVal, i) )".
  4. Error handling - if something goes wrong in the code following the call to libusb_open(), the value of "retVal" is overwritten (by the CHECK_STATUS() macro), causing a resource leak. You probably want to use a different variable rather than retVal, and have an error label at the end that will call libusb_close() on it if an error is detected in the detach code. Have a look at the error handling for usbOpenDevice(), for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants