usb printer and stm32F4 host communication - printing

I want to interface my printer with my stm32F407VGT6 board, and I don't know which usb driver library to choose (OTG/DEVICE/HOST).
I want to send / receive microcontroller commands to the printer.
thank you in advance :).

You can either use the USB host library, or the OTG (On The Go) library which allows you to be host or device. You should also take care that you are using the right library for your chip.

Related

ASCII code on an external device through USB port

Is it possible to send an ASCII code on an external device through USB port using IOS API? I assume that it is possible through bluetooth connection, but I'm not sure through USB connector. Any thoughts?
I would appreciate if someone could put me in the right direction.
Thanking you in advance
That largely depends on the level of sophistication of this "external device". If this external device is just a bare metal embedded device without some sort of operating system you definitely need MFI.
Otherwise, you can run a usbmuxd server (e.g. on Raspberry PI with Linux) to establish a connection via USB. Usbmuxd is basically the technology that Apple uses to communicate between iOS devices and Desktop apps such as iTunes or Xcode. And yes, it is App Store compliant, e.g., Duet Display uses this approach to make an iPad a secondary display for your Desktop via USB.
There are several open source libraries that provide a high level API, e.g., PeerTalk or DarkLightning.

How does this iOS app communicate over the USB port?

This app promises to turn your iOS device into a second monitor and uses the standard USB cable to connect to the computer, as opposed to the network which all other similar apps use.
Back when I heard about it, it wasn't yet available so I thought it was a scam. To my surprise, they released the app and it actually works as described.
How does it work ? As far as I know there are no APIs to drive the USB port in iOS, and the computer connected via USB through the standard charging/syncing cable doesn't count as an MFI accessory.
Note that they provide the server software (the one that installs on the Mac and streams the desktop to the device) on their download page for free, reverse-engineering it could shed some light on this but I unfortunately don't have the skills for that.
Dean told about it on his blog.
Duet uses Peertalk, an open source library allowing to pass TCP connections through the USB connection without being part of the MFI program.
The information, code and tools to accomplish generic USB port communication is available to those who join the Apple MFi program. You have to do the paperwork and get licensed by Apple.
http://developer.apple.com/programs/mfi/
The libraries necessary are included in the app and then the usual streaming libraries and code do the rest.

How to detect a usb host connection on a usb device system in C?

I am pretty new to Linux so I apologize if I will ask some really simple stuff.
I am working on a custom board with SAM9G25 and Angstrom distribution as operating system.
The board as to act as a USB Device (Mass storage device), when will be connected to a Host computer. Right now I am simply enabling and removing the g_mass_storage module and the things are working fine.
In the final version, I need to manage the g_mass_storage module according to the connection and disconnection of a USB cable. I tought to use VBUS as an interrupt (also polling will be fine).
Here it comes my problem.
Since the VBUS GPIO is handled by the USB driver i cannot read it's status from userspace. I only see an interrupt count in /proc/interrupt.
I am asking if there is a way to get an interrupt (from the Driver) or to be able to read the VBUS GPIO value when the usb cable is connected/disconnected from the system.
I apreciate any kind of help.
I know this is a bit old, but I found the same problem, and found from userspace you can view the connection status from the udc sys class device. For example, on my architecture the status of USB can be viewed from:
/sys/class/udc/ci_hdrc.0/status
PC connection: configured
Power adapter: powered
Disconnected: not attached
I've read the AM335x architecture can be observed from:
/sys/class/udc/musb-hdrc.0.auto/current_speed
Best of luck

Can I use pyusb to communicate with my USB device without installing extra driver

I want to develop a portable USB device. And now I want to communicate with this device by using Pyusb. I use python 2.7 under windows 7, and I install a backend (I choose libusb-win32) which will install its own driver. I am new to USB and pyusb, so I wonder if there is no driver, can I communicate with this device and can this device communicate with a clean PC.
Thank you very much in advance.
You probably already figured this out in the meantime, but the answer is "yes": Using libusb / PyUSB you can interact with a USB device without the need for a dedicated driver. You'll have to perform any protocol handling in user-space, though.

Simulate a USB flash drive with PC

I have a peculiar question.
The case is that I have a TV that can use as source a USB flash drive for playing movies.
Do you think it would be possible to directly connect a PC and the TV USB to USB and using some software interface to determine the PC to act like a flash drive.
I think it can be done with a hardware driver, but I'm wondering if it can be done without that.
No, you can't, not even by writing a new driver.
A flash drive is a USB device, but your computer has only USB host ports. There's different circuitry needed in a device vs. a host (there are circuits that can do both, called USB on-the-go, but those are only found in peripherals).
Actually, you can - kind of.
http://www.eye.fi
This is a special adapter with a Wi-Fi adapter built in that allows you to connect to a computer (or the Internet).
Not quite what you asked but the effect is similar.

Resources