Right. So I've been looking at VBS Scripts and batch files recently and autorun.inf would really be the cherry on the cake (don't worry I don't plan on using it as a tool for evil). I know that it has been turned off by default on Windows 7 onward but I read somewhere that it is still on for CDs. So naturally, I wonder - Is it possible to make the USB drive look as if it were a CD to make autorun work?
a USB pen drive and a USB CD tray have the same device class (USB mass storage device class). the problem is that despite the same device class there are other parts in USB protocol that differ (interface descriptors, configuration descriptors, endpoint descriptors,...) These usb descriptors that are also responsible for what driver / kernel module is loaded by the os, are hardcoded in the firmware of the device. your only chance to make a pen drive appear as a CD is to change these hardcoded descriptors or what is easier, to build your own device using a microcontroller with USB functionality in that you program your custom descriptors. Note that kernel modules and drivers are based on standardized protocol so your descriptors have fit these standards for the device to work.
In http://www.beyondlogic.org/usbnutshell/usb1.shtml is more information about USB protocol and the descriptors...
Related
I have an STM32-discovery board and I am trying to program it with not using any cables.In the place where I am doing my internship, they first wanted me to program STM32-discovery with UART. I was able to do this by making the necessary connections and using the Flash loader demo. Now my next task is to add an ESP-07 wifi module on the STM32-discovery board, connect this module to the same network as my computer, and wirelessly program it from my computer. No other device is wanted in between (like Raspberry). I did some research on this topic but couldn't come to a conclusion. What I found; I can remote program by connecting the card to a Raspberry or a device called Codegrip. Is it possible to do this with only an ESP-07 without these devices? I will be glad if you just tell me what should I look for.
Yes, it's possible to reprogram the STM32 flash wirelessly if the STM32 is running a program that supports this capability. When you programmed the STM32 via the UART there was a program running on the STM32 that:
opened the UART port,
received the new program data via the UART (using some protocol),
and then programmed that new data onto the flash.
To do likewise wirelessly, the STM32 will need to be running a program that:
opens the Wi-Fi port,
receives the new program data via Wi-Fi (using some protocol),
and then programs that new data onto the flash.
You may have used the STM32 internal ROM bootloader to reprogram via the UART. And if so then you used the protocol required by that ROM bootloader. But the ROM bootloader probably does not support Wi-Fi. So you'll probably be creating your own bootloader program that can communicate over Wi-Fi. And you might be defining your own protocol for transferring the program data over Wi-Fi. Or maybe you can apply some established protocol such as FTP. Search for examples of bootloaders that support OTA (over the air) firmware updates.
There are two possible solutions.
Write a custom bootloader for the STM32 - the flash is organised with smaller blocks at the start to support that, so you would move your application to higher memory and have the bootloader either jump to the application to load a new application. The bootloader can then access the Wi-Fi module (and other interfaces) to get updates.
Write custom firmware for the ESP0-07 so that it receives and stores the STM32 image, then transfers it to the STM32 using the existing ROM serial bootloader. In this case you need the details of the bootloader protocol, and it would be useful if the ESP-07 had a GPIO connection to the STM32 reset line so that it can invoke the bootloader without a manual reset.
Either way, you need to write software for one or other of the devices.
You can use any standard bootloader and connect the Wireless module like ESP32 (Bluetooth and Wifi), ESP8266 (Bluetooth and Wifi), BT-05 (Bluetooth), HM-10 (Bluetooth), etc.
Then create the android application or web application and update the Firmware or application.
If you don't want to use the Standard Bootloader, you can implement your own bootloader and add this OTA feature to that.
We have added the Tutorials step by step. Please refer to this if you get time. There we have developed the custom bootloader and updated the Firmware.
I am working on Freescale P2041RDB, I have designed my own customized board similar to the RDB. But my board has few changes, like it doesn't have SPD controlled RAM and the CPLD is used only for Reset purpose and my board has a Pericom 1-to-4 PCIe switch. My problem is that when I try to access the PCI devices I am not able to do so. But when I try accessing it through U-Boot the device gets read, but the same thing when I try doing it with the Kernel, my system can't read the devices.
With the P2041RDB the PCIe works fine, I am able to access the PCI Devices.
I am using Yocto Embedded Linux kernel by Freescale.
You need to modify your device tree file according to your custom hardware. Devices are detected through uboot which means hardware wise it is ok but in kernel it is not able to detect which means device tree need to be modify.
I think you should check the device tree file, to make sure the configuration of PCIe is correct according your board. since u-boot can access your device then there should not any hardware fault on it.
I am currently trying to use LibUSB to directly access the firmware controller on a USB device. How do I directly download firmware off a USB device so it can be modified later (using either the SCSI commands or the LibUSB library)?
The closest thing you'll find to a standard here is the USB Device Firmware Update (or "DFU") protocol. However, there are a number of major caveats:
Most USB devices do not have updatable firmware at all. The majority of devices have their functionality fully defined in hardware, or in mask ROM.
Of the devices that do have updatable firmware, most do not use USB DFU to do so.
Even of the few devices that do support USB DFU, most do not support the "UPLOAD" command to retrieve firmware from a device. (It serves very little purpose in most devices.)
If you run into one of the rare devices that does fully support DFU, you may be able to interact with it using dfu-util. However, this is very unlikely.
I have been tasked with writing a USB driver for our embedded software to send raw data to Host. This will be used to send some logging data to host. We are using iMX31 litekit for development.
From the documents that I have read on USB, my understanding is that the embedded device will be in device mode only. Also it will only be communicating with host machine.
So can any one guide me here? Any article, reference or code is welcome.
Some things to consider:
Is this a high bandwidth device like a camera or data recorder, or a low bandwidth device?
For low bandwidth, I would strongly consider making your device act as a USB HID class. This is the device class that supports keyboards, mice, joysticks, gamepads, and the like. It is relatively easy to send data to nearly any application, and it generally doesn't require that you write a custom device driver on the host side. That latter feature alone is often worth the cost of lightly contorting your data into the shape assumed by the HID class. All the desktop operating systems that do USB can use HID devices, so you get broad compatibility fairly easily.
For high bandwidth, you would still be better served if your device fits one of the well established device classes, where a stock device driver on the host end of the wire can be used. One approach that often works is to use the Mass Storage class, and emulate a disk drive containing one file. Then, your device simply mounts on the host as if it were a disk, and you communicate by reading and writing to one (or a few) file.
I would expect there to be a fair amount of sample code out there for any serious USB device chipset that implements either or both of HID and Mass Storage.
If you really must wander into fully custom device territory, then you will need to be building device drivers for each host platform. The open source libusb library can be of some help, if its license is compatible with your project. There are also ways in newer versions of Windows to develop USB drivers that run in user mode using the User Mode Driver Framework that have many of the same advantages of libusb, but are not portable off the Windows platform.
The last custom device I worked on was based on a Cypress device, and we were able to ship their driver and an associated DLL to make our application code easier to build. I don't know off the cuff if there is any equivalent available for your device.
For a really good overview, I recommend the USB FAQ, and the latest edition of Jan's book, USB Complete.
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.