programmatically connect to USB devices from USB-over-IP hub Digi AnywhereUSB - dll

Is it possible and how to connect specifically to USB devices, connected to the Digi AnywhereUSB 8 Plus hub, via https, tcp/ip?
Our first idea was to connect USB devices to the USB-over-IP hub and connect to each of the device via IP:Port programmatically with a script locally or e.g. from Jenkins.
I found a document:
Digi International Anywhere USB Library API Specification
https://www.digi.com/support/knowledge-base/anywhereusb-api-information
when installing their driver in following paths.
https://hub.digi.com/support/products/infrastructure-management/digi-anywhereusb/?path=/support/asset-collection/os-specific-drivers-anywhere-usb/
driver install path and files:
C:\Program Files\Digi\AnywhereUSB\Advanced
AwUsbApi.dll
AwUsbApi.pdf
Apparently there are some functions provided e.g. :
AWUSB_STATUS
AwUsbConnect (
IN LPCWSTR Hub,
IN PAWUSB_STATUS Status,
IN DWORD Timeout,
IN HANDLE hEvent OPTIONAL
);
The task at hand is now, how to script a connection to plugged-in USB devices? What language /environment would you suggest?

Related

Can't open HCI socket.: Address family not supported by protocol

I am developing an app that needs to connect to a BLE device, but i cannot find them to establish a connection and read the bluetooth device(yes, it's on) and i can connect it to another app only from this app . So, i try to sniff the bluetooth connection with bettercap in my kali linux running in WSL2, but when i try "ble.recon on" i get:
bettercap v2.28 (built for linux amd64 with go1.14.4) [type 'help' for a list of commands]
eth0: You don't have permission to capture on that device (socket: Operation not permitted)
And, if i try: "hciconfig" i get this issue
Can't open HCI socket.: Address family not supported by protocol
I think that i need to enable my hci socket or something. I need help.
I'm open to other ideas to establish a connection with tis device
Device: M1001 mopeka
App(working): gascheck
WSL2 isn’t allowed access to the network or bluetooth card directly. It is give an internal bridge IP address. From the outside, windows is making the network connections not kali. So, if you need to use this, maybe you can try dual boot.

Possible to share USB port for ST-LINK over remote desktop?

Is this possible? Plug STM board into local USB port, configure sharing device under Remote Desktop settings ("Local Resources > More"), then remote into PC running STM debug software and try to access board through ST-LINK via shared USB port? When I try, the software doesn't see the device.
This sort of thing works with other shared devices (drives, etc), but the STM software doesn't see this particular device. The device is visible locally before I open remote desktop.
Your apprach is wrong.
Connect the STM on the target machine. Run OpenOCD on that machine and connect via TCP from your local machine.
It is called remote debugging.
No USB magic

Can I duplicate the behavior of one tty on another tty device

I am currently developing an application that connects to a device via USB but due to project modifications I have to move it to a target device whose only serial communication is via RS-232 DE-9 port.
To communicate with the device I use a proprietary API. Using strace I know that it scans all devices in /dev/bus/usb and after finding the right one the API connects to it.
I wanted to know if I could some how emulate my device in /dev/ttyS0 to an unused usb device in /dev/bus/usb/ to connect to it

How to control removable usb devices with VMware vmrun

I have VMware workstation 9 and 10, and I am wanting to use that to run some integration tests.
Using the vmrun utility, I can copy scripts to and run them on the virtual machine guests. However, some of the integration tests will require interfacing with USB devices.
Is there any way using vmrun, or any of the vmware API's to programmatically control the "Removable Devices" to connect and disconnect USB devices to virtual machines?
I have tried looking at the readVariable and writeVariable commands, however I cannot find any useful information on that subject.
vmrun has no facility to passthrough USB devices from the host to the guest and vice versa (source, VMware employee). There are though 2 options to achieve this behavir
A) Use autoconnect: look here and here on how to modify the .VMX file to auto connect the USB device to the guest VM. Basically you need to add usb.autoConnect.device0 = "vid:XXXX pid:XXXX" to it.
B) Use askConnection: When you plugged in the device to the host, and the VM is powered on, you can select to connect the device to the VM and remember the choice. Then the next time when you pluggin the device again, the device will be automatically connected to the remembered VM. Also, you can configure in Edit > Preferences > USB for other choices. Currently, this feature only works when you plug in the device.

How to emulate USB devices?

The rest of my team will make for my application a simple non-standard USB microphone, but until they finish it I will have to emulate it, for integration testing purposes.
Is there any risk in a physical loopback? Yes there is
Will a physical loopback work? Only with a USB bridge
There is any way to create a logical loopback? (MSDN has something about this)
There is any general purpose USB emulator software?
In case there is many options available I'd rather work it .NET/Matlab/Python solutions.
Edit: Proof of concept here
I strongly recommend this project, USB IP. It is a way of connecting USB devices over the network. There is a Windows client.
What this means is, you install the client on your Windows computer.
This device then expects to talk to a USB device connected to a Linux computer, the server:
What you now do, is either create a fake device driver for Linux, that looks like is connected to a physical USB device, but in reality is just logic pretending to be your USB device. There are tutorials for writing USB drivers for Linux. Or you create your own stub driver for the Device Control Manager (see picture above). This stub driver could run on Windows or Linux, it wouldn't matter. It could even run on the same Windows machine which is the USB client.
The DSF USB Loopback Device mentioned in the question itself, would be the same kind of solution as a stub driver for the Device Control Manager, but taking Linux out of the picture altogether.
You can write virtual USB device using QEMU.
You can duplicate already existing device, like the dev-serial.c found in this QEMU repository and change it for your needs.
After you write and compile your USB device you can simply attach it to your VM using the QEMU command line interface.