pyftdi finds device under OS X but not Windows - windows-7

I have an FTDI FT230XS plugged into my MacBook Pro. The following works under OS X / python3.6:
from pyftdi.ftdi import Ftdi
x = Ftdi()
x.open_bitbang_from_url('ftdi:///1')
However, I'm having trouble doing the same thing under VirtualBox running Windows 7 (32 bit). I've taken pains to make sure the USB device is present in the VirtualBox environment: I get the little "bu-dum!" sound when I plug it in, and serial.tools.list_ports.comports() confirms that it is present. However, the open fails:
>>> from pyftdi.ftdi import Ftdi
>>> x = Ftdi()
>>> x.open_bitbang_from_url('ftdi:///1')
Traceback (most recent call last):
File "C:\...site-packages\pyftdi\usbtools.py", line 375, in parse_url
candidates[idx]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
...
pyftdi.usbtools.UsbToolsError: No USB device matches URL ftdi:///1
Any idea of what I should be doing differently?

Assuming you've already loaded libusb-win32 from some source (Zadig, libusb win32, etc), you need to declare the FTDI device to Windows as described in the documentation. A recap of the steps:
download and install libusb-win32-devel-filter-x.x.x.x.exe from the libusb-win32 Sourceforge site. Choose the latest release (currently 1.2.6.0) and make sure you download the devel-filter installer.
Plug in your FTDI device, click to run the installer and follow the directions. It should create a filter for your specific device.

The easiest way is to download ZADIG and use it to install libusb for the device you want to use in pyusb.
Remember to flag "Show all devices" in the Options menu.

Related

How can I create a Bulk USB Gadget WinUSB Device

I created an small embedded WinUSB device which offers 2 bulk endpoints. This device can communicate with Linux and with Windows10 without installing driver, or a .inf file.
Now we want to use the same API with a embedded Linux. The USB-Gadget mode offers Serial CDC/ACM and RNDIS-Ethernet and many more.
I was able to create a USB-Gadget with the gadgetfs which had only bulk ep. I could communicate with Linux and Windows host. The USB-Device had /dev/ttyGS0 to communicate. But in Windows I had to install WinUSB driver manually.
I work with yocto to create embedded kernel.
I added some line of code here: /linux-imx/drivers/usb/gadget/legacy/serial.c , f_serial.c, u_serial.h to add additional variable os_desc and parameter use_winusb. But the resulting g_serial still creates a COM-Port in Windows10 or a no WinUSB device. For our device we need WinUSB-Device only.
The RNDIS Gadget does has WinUSB support. So I tried to create a own USB-Gadget device with https://github.com/libusbgx/libusbgx. But if I use the USBG_F_SERIAL function type then it can't create WinUSB. See error:
Error setting function OS desc
Error: USBG_ERROR_NOT_FOUND : Not found (file or directory removed)
If I use USBG_F_RNDIS, it works, and with manipulated USB descriptor it'll recognized by Windows as WinUSB device. But Linux implement's it as USB-ETH ethernet device. The USB-Device get's no /dev/ttyGS0 serial connection to communicate.
I'm reading the Linux kernel driver source now, to find the position, where I can simply ann this WinUSB os-descriptor stuff into the USBG_F_SERIAL type. But I think it'll take month to get through.
Any solution would be ok. Patch for the Linux driver sources g_serial or how to configure a USB-Gadgetfs would be great. Any hint, where to put additional code would also be fine.
I wanted to change the kernel, but fortunately found this:
https://blog.soutade.fr/post/2016/07/create-your-own-usb-gadget-with-gadgetfs.html
This code made it easy to add WinUSB features.
Source of modified Version for WinUSB: https://github.com/rundekugel/gadgetfsd/tree/WinUSB

I can not start ubuntu with USB

The PC is Windows. I wanted the ubuntu environment, I put the ubuntu iso file on the USB. After that, if I try to restart and start ubuntu, I get an error like the following.
Like this error
The details of the error are the two statements below.(initramfs) Unable to find a medium containing a live file system[figure ex.) 135.392108] usb 3-4: device descriptor ewad / all, error -110I tried variously, but it was useless. (I tried BIOS etc. but it was useless.What I want to do is to have Ubuntu portable on the USB. However, I want to prevent any Windows from being broken.I do not know the meaning of 2.0 / 3.0 on the USB drive side and socket side.The one that I use is USB 3.0.Ubuntu version is 18.04.2. The iso. file was loaded with Universal-USB-installer.I tried both UEFI and LEGACY mode with BOOT on the BIOS screen, but it was useless.

Install dummy (null) driver for unsupported device

We have a hardware device that presents as a composite USB device: MSC+CDC+HID+WebUSB. We don't want to support WebUSB for Windows 7 for a variety of reasons, but would like the device to install "successfully" and find drivers for all the USB interfaces it supplies, so that the user doesn't see the Windows notification "Device driver software was not successfully installed".
On Windows 10, support for all devices is already built in. On Windows 7 we supply a driver installer that provides CDC (usbser), and the others are built in. The .inf file for CDC matches the device's USB VID, PID, and a specific MI, e.g. USB\VID_vvvv&PID_pppp&MI_00. The WebUSB device is at USB\VID_vvvv&PID_pppp&MI_04.
I'd like to supply a dummy driver for MI_04 so it installs successfully but does nothing. Is there a built-in dummy driver available in Windows 7, or some way to use some other built-in driver that will do nothing? Or is it easy to build a dummy driver to install for that interface?
I had the wrong search term. I wanted a "null" driver. Link here explains: https://learn.microsoft.com/en-us/windows-hardware/drivers/install/installing-a-null-driver. A null device is recognized but not used and will not be started.
Based on the link above, I added something like this to my .inf:
[Devices]
...
"WebUSB device dummy = NullInstall, USB\VID_vvvv&PID_pppp&MI_04
...
[NullInstall]
; empty
[NullInstall.Services]
AddService = ,2 ; no value for the service name

Install driver without plugging in device

I'm trying to install some unsigned legacy drivers to my computer from command line. I have used dpinst.exe and installhinfsection functions which work fine, however everything I've tried is software first, meaning it installs the driver onto your computer and then doesn't actually show up in the device manager until you plug the device into your computer.
I'm wanting to install the driver and have it show up in the device manager without having to plug in any devices.
I can do this with adding legacy hardware from the device manager, but I want this to be an automated process so all from command line and not having to do it manually through device manager.
thanks in advance
EDIT
The drivers were written by me (UserModeDriverFramework), they are emulating real devices.

Download program into AVR chip with FTDI4232

Background info
WinAVR:
I installed WinAVR, and use avrdude.exe comes with WinAVR to download program into our board.
Adapter card:
We have an adapter card with FTDI4232 and AVR m328p on it. PC connects to FTDI4232 with a micro USB cable.
Schematic:
Sorry, I cannot post pics. So just describe the major part of schematic here. Two wires from(DATA_P & DATA_N pins) out from macro USB connector to DP[pin8] and DM[pin7] on 4232. And four wires(SCK, MOSI, MISO, SS_N) out from 4232 to m328p.
How to download program into the card before: Via pocket programmer. But we cannot give one pocket programmer to every engineer, so try to find out a way to download the program into m328p. Coz we have already had FTDI4232 on board, so this seems to be the best choice.
Can I download program via FTDI4232 on adapter card?
I know there is dedicated programmer based on 4232 chip, but this is our own design, I am not sure we can do it or not according to the above schematic.
what I did
Run this command:
C:\WinAVR-20100110\bin\avrdude.exe -c 4232h -p m328p -U flash:w:\Desktop\work\a_card\WinAVR\blink\blink.hex:i
But got the following error:
avrdude.exe: Error: no libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.
Then, download the compiled libftdi package from this link:
https://code.google.com/p/picusb/downloads/detail?name=libftdi1-1.0_devkit_mingw32_17Feb2013.zip
, and extract it as “compiled_libftdi”.
There is not too much info about how to use this compiled package, so I just found info online.
(1) I installed WinUSB driver for the first two ports of 4232 by Zadig. I can choose one port in the drop down menu, then choose “WinUSB(v6.1,7600…)”, “Install WCID Driver”.
(2) Then, enter into the “compiled_libftdi” folder, run “find_all”, I saw:
Number of FTDI devices found:1
Checking device: 0
Manufactureer: FTDI, Description: USB <-> Serial Converter
I think it means the USB driver for libftdi package installed successfully.
Run the above download command again, still failed.
I thought maybe because the avrdude.exe is out of date. So download a .exe from here:
http://download.savannah.gnu.org/releases/avrdude/avrdude-6.0.1-mingw32.zip
And replace the old one in the WinAVR folder.
Still got the error, but got one extra line info:
avrdude.exe: programmer operation not supported

Resources