Is a terminal and USB Device or a USB Host - device

If I use Tera Term, to connect to a USB OTG port on a STM32 MCU, is Tera Term a USB Device or a USB Host.
The question arises as I presumably could configure the STM32 OTG port to be a USB Host CDC or a USB Device CDC.
It's possible that it doesn't matter what I configure the STM32 USB OTG port as, but it's possible that there may be a specific standard that defines what should be done.

If I use Tera Term, to connect to a USB OTG port on a STM32 MCU, is Tera Term a USB Device or a USB Host.
Neither.
Your computer is a USB host. The software running on your computer doesn't affect its role.

Related

Coral Dev Board "mdt devices" can't find any devices

I was following the Coral Dev Board get started guide - Get started with the Dev Board (https://coral.withgoogle.com/docs/dev-board/get-started/). Everything worked fine until to the step - Connect to the board's shell via MDT.
I've waited about 5 minutes until the flashing to complete, and the terminal prompt returned to me, then I tried the command:
mdt devices
The terminal returns nothing. Unlike the guide says it supposes to return my board hostname and IP address. I've checked the USB-C OTG and USB-C power cable, they are all connected well.
I've also tried this solution: https://superuser.com/questions/1452786/coral-dev-board-not-recongized-on-mdt-shell. I went to Network under System Preferences, and clicked "+" icon, but I couldn't find the mendel device.
I'm using Macbook Pro running on macOS Catalina. The fastboot and mdt commands are both working.
I just found a solution:
Just plug micro-B USB cable, then run:
screen /dev/cu.SLAB_USBtoUART 115200
If it shows blank, wait a couple seconds, then plug usb-c power cable, the system of the dev board will start loading, the login prompt will come out. After I logged in, I plugged the usb-c cable into data port(keep the micro-B USB cable in at the same time), then run:
mdt devices
or
mdt shell
This solution works for me only when I have turned on the wifi of the dev board and connect it to the same wifi network. If you want to turn on the wifi network of coral dev board, run the command on screen terminal:
nmtui
The Network Manager TUI prompt will come out then you can connect to your wifi network.
It's a problem on macOS Catalina. It doesn't "see" USB connection as a network connection and as such it is impossible to connect to Coral Dev Board.
I have the same issue, but I tried with another MAC with older macOS and it worked just fine.
Now, I don't have yet the solution, but at least we all know the problem ;-)
Regards,
Rui
First check the that the device is detected by running dmesg command.
Normally you should see something like this
$ dmesg
...
[107834.681816] usb 2-3: new high-speed USB device number 3 using xhci_hcd
[107834.845073] usb 2-3: New USB device found, idVendor=18d1, idProduct=9304, bcdDevice= 4.19
[107834.845077] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[107834.845079] usb 2-3: Product: Mendel
[107834.845081] usb 2-3: Manufacturer: Google,LLC
[107834.845083] usb 2-3: SerialNumber: bored-horse
[107834.985296] cdc_acm 2-3:1.0: ttyACM0: USB ACM device
[107834.986069] usbcore: registered new interface driver cdc_acm
[107834.986070] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[107835.005045] cdc_ether 2-3:1.2 usb0: register 'cdc_ether' at usb-0000:06:00.3-3, CDC Ethernet Device, aa:9f:04:54:dc:45
[107835.005124] usbcore: registered new interface driver cdc_ether
[107835.019787] cdc_ether 2-3:1.2 enxaa9f0454dc45: renamed from usb0
[107897.336866] IPv6: MLD: clamping QRV from 1 to 2!
[107956.344960] usb 2-3: USB disconnect, device number 3
[107956.345357] cdc_ether 2-3:1.2 enxaa9f0454dc45: unregister 'cdc_ether' usb-0000:06:00.3-3, CDC Ethernet Device
...
After that, check your network interfaces using ip command
$ ip link
Then look for the one with the one with the same MAC address as the one that appears in the logs of dmesg.
Once you find it, run this command to assign an IP address
$ sudo dhclient <name of the network interface of coral dev board>
Now you should see an IP assigned to the interface.
$ ip a
After that, run mdt devices and you should see the dev board connected.
$ mdt devices
bored-horse (192.168.100.2)
I had the same problem in Debian (Buster). I was able to follow all the steps to connect and flash the device until 'mdt shell' and I would receive a 'Unable to find any devices on your local network segment' message.
Opening the network settings and enabling 'USB' as a network interface worked for me.
After connecting to the Coral Dev Board the first time and exchanging private keys, I unplugged the USB cable. After that, my computer was offline until I re-enabled the ethernet connection. It seems that enabling the USB network disabled the ethernet. At that point, mdt shell was able to connect via the ethernet network.
So I've just spent most of the afternoon with this issue. After I downgraded the OS to Chef it seemed to work fine as the USB device (OTG port) would initialize on boot and then the SSH key could be pushed through. However, with the latest OS (Eagle) this was not the case.
The fix was simple:
Remove the USB C OTG port cable from the board
Reboot the Coral board
Wait for boot sequence to complete
Connect the USB C OTG port cable to the board
Run "mdt shell"
key is pushed through!
Now I can set up the WiFi or connect Ethernet and remove that cable once again and now I can freely call mdt shell and it connects every time.

How to forward an URB from Window USB Driver to another PC?

In my course, i need to develop a USB sniffer capture URB (USB Request Block) pass from USB device, then forward to a another PC.
For example, look at "Setting -> USB -> Enable USB Controller" in VirtualBox. When you enable this setting and plug an USB device in Host PC (Window OS), you can attach this USB device into Guest PC and read/write data or do something else in the USB device. Simultaneously, on Host PC, you can't see the USB device. If you can also detach this USB device from Guest PC, on Host PC, you can see the USB device again. URB of the USB seem to be forwarded to VirtualBox USB Driver.
I don't know what mechanism that they used? Could you please explain for me?
P/S: Can i develop a filter driver to do that?
Thank so much!
for the disconnect usb device from host and reconnect it to VM, the pattern Dynamic driver substitution has the explanation how VMware workstation does it.
for the URB part, i think USB/IP is a good start point.

Use of xHCI driver and USB_STORAGE driver

I'm currently learning driver programming and am at very nascent stage. I'm unable to get the difference of use of xHCI, EHCI, or OHCI drivers and usb_storage.
When I plug my USB device (pen drive) and observe dmesg output, it says that my device is using the ehci driver, but my device stops working when I rmmod usb_storage.
There are many drivers for different kind of USB devices let it be mouse, keyboard, camera, etc.
As of now, I assume that the xHCI driver is for USB host and the other driver is for the device we connect to our USB host. Am I correct? If not, what is the explanation?
*HCI are specifications of USB hosts:
xHCI - for USB 3.0
EHCI - for USB 2.0
OHCI and UHCI - for USB 1.x
usb_storage is a upper level driver working on the USB host side, and it is responsible for communication only with USB storage devices, not keyboard, mouse, etc.
The USB is maintained in form of a stack and *hci drivers are the lowest level in that stack. usb-storage and other drivers are located on a higher level of this stack.

How to identify USB port path/address in windows?

This question relates to node.js to read usb port signals
What is the possible way to get usb port address from windows7 32bit? For eg: If my phone is connected to one of the usb port how can i get the path/address of that USB port?

how linux kernel detects power over ethernet (PoE)

I want to capture a signal in the kernel when it detects power over ethernet is connected.
I don't have gpios to do this business.
I am working on the atheros chipset based access point. It has Realtek RTL8363SB ethernet module. Is there any mechanism/interrupt/signal/api in kernel which detects from where it is getting power?
I have enabled CONFIG_POWER_SUPPLY while building kernel V 2.6.36
Thanks.

Resources