I am working on LTE USB modem driver installation.
While plugin USB device it detect as CD-ROM and we need to switch it to USB modem before installing windows modem driver on the device.
How does one go about executing a USB switch mode on Windows?.
I found it can be done using DeviceIOControl() IOCTL_SCSI_PASS_THROUGH_DIRECT. But I am unclear as to what values need to passed in struct SCSI_PASS_THROUGH_DIRECT.
Is there any other method to do USB mode switch ?
Otherwise, what values need to pass in scsi ioctl?
Related
I have a UPS which outputs data, like battery status, via serial port. This UPS is connected to a computer via USB, using a serial port to USB adapter. Communication with the UPS is possible with hyper terminal via a custom protocol.
Is it possible to write a HID power device driver for Windows using the USB output from the UPS? This driver should translate the custom protocol to the HID power device protocol.
Yes that can be done by writing a WDM or KMDF USB HID mini driver for your UPS. In the HID Mini driver, you must have to define the HID report descriptor with USB power device usages in the hid collections. In that driver you need to configure and enumerate your USB pipes which are used for virtual serial port communication right now. You have to send and receive data directly from and to USB pipes.
In this HID mini driver, once you define report descriptor with usage pages such as Battery system with necessary uses as hid reports and handle IOCTL calls from the top HID class driver, you can see your UPS attached as a HID UPS Battery in the Windows device manager. You can see the UPS as a battery with charging status, AC power status, battery remaining capacity % on the power options panel as well as in the system tray, like what we see in the laptop's battery status on the system tray.
Also you can send the existing UPS commands what you are sending now via hyper terminal would be then sent via HID API calls such as HidD_GetFeature, HidD_SetFeature, HidD_GetInputReport, HidD_SetOutputReport functions from a custom developed application as per your requirements.
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.
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.
Our USB composite device will support different functionality.one interface will support Network functionality.
We are developing different NDIS miniport versions for different OS.(NDIS 5.1 for XP, NDIS 6.1 for Vista and NDIS 6.20 for Windows7 OS).
We have one test case as shown below:
1) After loading all drivers(serial and NDIS) open any serial interface using Hyperterminal
2) Do Some communication (enter AT command etc)
3) Unplug the device with out closing Hyper terminal
4) Replug the device to the same USB port.
For the above test scenario, NDIS miniport driver fails to load after step-4(error code 31) on XP OS.NDIS Miniport drivers' Initialize handler is not called.
On other OS i am not able to reproduce this issue.
Please let me know your valuable suggestions for this issue.
It's possible you're not releasing all of the resources you hold upon unlpug. Check your unplug handler code.
I need to create a application that will allow a Windows PC (XP/Vista) to emulate a thumbdrive. That is, when the PC is plugged into either another Windows system, or in this case, a piece of hardware that allows for USB thumbdrives to be plugged in, a folder on the computer looks like a giant thumbdrive. Any thoughts on where a guy would start to investigate this?
Update (more specific description):
I need to connect my PC to one of the newer multifuction devices that support scanning to a USB thumbdrive that is inserted into the front of the device. These units do not support WIA or TWAIN via the rear USB connector that you'd typically use for connectivity to a PC.
Most USB controllers in regular pc's dont have the possibility to function as an USB slave. So I'd start with investigating what kind of hardware you're going to use.
Another way to go: there are USB Link cables to link up 2 pc's over USB, maybe that's usable for you?
You cannot do this in an application. At the lowest level, the USB ports on your computer are controlled by an Host Controller Interface. This chip will manage up to 127 slave USB devices. You would need to seriously reprogram this chip before it implements the slave side of the USB protocol. Of course, at that point any USB hub in your PC will break down - those 8 USB ports you probably have are usually implemented by 2 smart USB hubs connecting to both USB1 and USB2 host controllers. Next, your USB keyboard and mouse will stop working.
Take an MCU with two Slave USBs. Write a simple frimware which makes one USB act as a Special Device Class and wait until PC on this USB provides mandatory data (including Device Class, of course) for the other USB. Write a PC program which connects to the Special Device (your MCU), uploads Mass Storage Device Class and redirects I/O to a dedicated partition. The other USB on the MCU will become an emulated Mass Storage Device.
Some of those code can be taken from Linux.