USB function controller emulation in QEMU - function

Does QEMU provide emulation for any target with USB device controller? Actually I am developing an embedded linux based device and was thinking about testing it on QEMU.
BR,
Mooni

You can find this information in the QEMU Manual, section "3.9 USB emulation":
QEMU emulates a PCI UHCI USB
controller. You can virtually plug
virtual USB devices or real host USB
devices (experimental, works only on
Linux hosts). Qemu will automatically
create and connect virtual USB hubs as
necessary to connect multiple USB
devices.
There you also find all relevant configuration parameters.
The USB Controller is provided for the following targets:
PC System
MIPS/malta has a PIIX4 PCI/USB/SMbus controller
ARM: has various options

I'm looking for this as well. There is a bit of code for virtual usb devices in the repo but I'm specifically looking for a way to write a dcd (device controller driver) which can be accessed as a virtual device from the host running the qemu simulation. I'm looking for a way to implement this for stm32 family.

Related

Failed to claim interface: Operation not supported or unimplemented on this platform

I'm trying to use a USB Barcode Scanner on Windows 10 in Chrome v73.0.3683.86 via WebUSB.
The scanner is a Honeywell Voyager 1250g.
I can see the device via the device dialog - I can also open it and select a configuration.
However, when I try to claim interface(1) (There are 3 interfaces, but 1 is the bulk transfer) I get the error Failed to claim interface: Operation not supported or unimplemented on this platform in chrome://device-log/.
Is there a way around this, or is this scanner just not usable via WebUSB? Thanks!
Have you tried connecting to this device using WebUSB on other platforms? Windows has a particular additional requirement for applications (like Chrome) to access USB devices which is that the WinUSB.sys driver must be loaded for the interface.
I've written an article explaining the particular requirements on Windows here: https://developers.google.com/web/fundamentals/native-hardware/build-for-webusb/#windows
If you use the Windows Device Manager you can check which drivers are loaded for your device. If there is no driver loaded then you may be able to write a custom INF file as described in that article to instruct Windows to load the driver you want.

WebUSB and RFID readers

I was wondering if anyone had any experience getting RFID readers to work through WebUSB. The reader I'm using is the https://www.parallax.com/product/28340 .
From what I've read, I'd have to write a driver to read from the device. I was just wondering if anyone has done any work regarding this and what they ended up doing.
The goal here is to read RFID tags without using another application to feed it to the web application.
Thanks!
The USB variant of that RFID reader uses an FTDI FT232R chip to provide a serial-to-USB interface. If the host operating system has a driver for this chip or the FTDI Virtual COM port drivers are installed then the browser will be unable to connect to the device when your application requests it through the WebUSB API because the USB interface presented by the device will already be claimed by the driver.
If you are able to guarantee that the Virtual COM port driver is not loaded then you will be able to write a driver using the WebUSB API to control the device.

WinUSB application on raspberry Pi (win10 IoT)

I want to install and discuss with my own usb device on a raspberry pi with windows iot.
For that, I just create an inf file for arm like WinUSB driver on Windows 10 IoT. The device is recognized by the raspberry (seen on the startup list of connected device). Then I want to discuss with the device.
First, I have tried with the "winusb.dll" but I need to use the library "SetupApi" that does not compile for ARM. (I used this solution on windows PC and communicate correctly with the device).
Do you have an idea on how to communicate correctly with an winusb device on windows iot?
Thanks in advance for your answers.
So, I try to migrate to Windows.device.usb, and I don't succeed in connecting to the device. There there an exception when I call the FromIdAsync() function. It's exactly the same issue as : Can't access USB device in Universal App
There are some fantastic samples that can be found here.
https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/CustomUsbDeviceAccess
Download all the samples. Check where it creates watchers based on specific devices (there are two samples in there, you'd need to add your own in) the page that displays USB descriptors checks on the device type -- add in a check so that it returns DeviceType.all to see if it can query the descriptors.
I've managed to get it working on Windows 10 desktop, but have failed to craft an INF file that I can use on my IoT device. Once I get that working, I may return.

How to find out which terminal is being configured?

Assume you want to connect your Ubuntu 13.04 desktop computer via TTL-232R-3V3 USB cable to the UART interface of an embedded system running an individual Linux flavor, that does not belong to a major distribution. Your own machine offers you the interface to your connection via /dev/ttyUSB0. Because you are using a framework for a high level language (pySerial) you know that you configure some terminal options via the C-struct termios.
Now the question is, where is that terminal you are configuring? Is that information you send to the remote device and configure that? Or do you simply configure how the /dev/ttyUSB0 interface is interpreted by your system? Or is there maybe even some configuration happening in the logic of the UART-to-USB converter cable? And if all 3 are possible, how would you determine which set of parameters where configured by your termios manipulations on /dev/ttyUSB0?
If it makes things easier to explain, consider the example of LF/CR handling which can contain, depending on the flags you set, either only LF, only CR or both as would be typical for windows. My question is not limited to these options only, though.
Note: I came to that question after I realised that I already saw some options active, that the man page declares as not available in POSIX and Linux.
All the configuration options are settings for the device driver. Most of them are implemented entirely in the driver software, such as echoing, CR-to-LF translation, and raw-vs-cooked mode.
Some of them, such as modes related to RS-232 signals, might be implemented in the device hardware, and the device driver will perform the appropriate device control operations to enable those options.

How do I capture console output from a remote NSight session?

I have a set of CUDA apps that both write to the console via cout. I have a host machine with VS and NSight plug-in and a target machine with NSight service. However, when I execute the console app, it actually runs on the target machine (literally pops up a console).
So here's the question: how can I get the console to show up on the host and only the GPU stuff to execute on the target? Is this even possible?
Thanks!
The short answer is that it is currently not possible. The application on the target is executed by the Nsight Monitor process but Nsight Monitor currently does not forward the output back to host.
Currently your only option is to take care of it your self by capturing the output of your application on the target and somehow display it on the host.
If this feature is important to you i suggest you file a feature request via your Nvidia developer account.
The CUDA application completely runs on the target machine, so the console or UI for the application will be seen on the target machine only. You can set breakpoints in the GPU code in the VS side (your host machine), and it should break there.
If you feel the application quits too quickly and is not launching the kernels as expected (and you are not hitting the breakpoints), it may be that you have not deployed all the required DLLs on the target machine (e.g. CUDART).