Linux based USB HID device , how to? - usb

I would like to configure my Embedded Linux kernel in USB-HID device mode and considering, I am new to USB, So I don't even have much idea about terminology for this particular mode to do grep in kernel code or find the right documentation, any help on this topic will be much appreciated

http://www.linux-usb.org/USB-guide/x194.html
Before cross compiling update .config with USB gadget. Just search for USB in kernel .config

Related

Isochronous iMX6 USB gadget Implementation Issue

I'm trying to implement a USB gadget using Linux on NXP iMX6 which implements an isochronous IN endpoint but got stuck as the gadget application on the iMX6 seems to hang, and eventually resulting a reboot of my i.MX6 platform.
Started with the usb.c example from http://www.linux-usb.org/gadget/usb.c and modifying it for the iMX6.
The Linux Kernel used for this development is Ver. 4.1.15.
Then, mounting the gadgetfs framework using:
modprobe gadgetfs
mkdir /dev/gadget
mount -t gadgetfs none /dev/gadget
This results in a 2184000.usb file in the /dev/gadget directory.
Modified the usb.c example to look for this 2184000.usb file and fill a set of USB descriptors. The host computer did recognizing the iMX6 as a USB device with the USB descriptors which I configured. But then, the gadget application on the i.MX6 seems to just hang and then reboot my Linux platform eventually.
Has anyone experience the same situation and got a solution? Please can you share source code or suggestion? Thanks!

sending and receiving frames over RS485 with Raspberry Pi

My task at work is to use a Raspberry Pi 3 to controll a turntable.
The turntable has an internal RS485 serial port which can be accessed through a build in FTDI USB converter (USB-RS485-WE-1800-BT).
I am using Raspbian Jessie Lite on the Pi and have not jet decided, what programming language to use.
First of all it seems to me, the FTDI converter is properly installed. Please correct me if I am wrong:
pi#turntable_ctl1:~ $ dmesg | grep FTDI
[ 2.236219] usb 1-1.3: Manufacturer: FTDI
[ 5.085380] usbserial: USB Serial support registered for FTDI USB Serial Device
[ 5.086330] ftdi_sio 1-1.3:1.0: FTDI USB Serial Device converter detected
[ 5.087760] usb 1-1.3: FTDI USB Serial Device converter now attached to ttyUSB0
Also if I run minicom -D /dev/ttyUSB0 (there turn hardware flow control off and software flow controll on and set the baudrate to 19200 8N1) the red LED inside the USB plug of the converter is blinking with every of my keystrokes.
Unfortunately there is no complete documentaion for the turntable, because it is custom made for us by a company in france. The guys there have provided me with this graphic (half in english/half in french) along with the following information:
"When you send us a PC frame the board respond with a MT frame."
As far as I understand this, to get the table turning I now have to open an RS485 connection on the /dev/ttyUSB0 and then do something like:
sendChar(P)
sendChar(C)
sendChar(1)
sendChar(100) // for example
sendChar(1) // for example
But I have no idea how to do that in any programming language. And even worse, I was not able to find any sample of code that does this, allthough I expected this to be a rather standard task.
So if anyone could point me in the right direction or tell me where my train of thought went off the rail, I would be very grateful!
Thanks for your time!
Mark
If this may concern anyone other than me, here is my solution:
After some more searching and a lot of hints from friends I found this library that offers (among other helpfull tools for Raspberry Pi) a great simple toolset for serial communication on the Raspberry Pi.
WiringPi - Serial Library
Gordon has all the documentation and Tutorials on his website you will need.
Thanks to Gordon!
Mark

How to power off USB device from Windows using batch or any API

For testing purposes I need to power off a USB device from my computer programmatically. The microprocessor in the USB device is ARM Cortex M4.
I have tried using Devcon, although the device was disabled, power was still provided to the device.
I have also tried to disable the USB root hubs ,that also didn't work.
I have read some other posts indicating that a SSR could be used, this option is not desired. I would rather choose the software solution(if there is one of course).
Some other answers have indicated that this is an OS issue, and some others a chip-set architecture issue.
So my question is what options are there available. And also is this purely something dependent on the computer side or do we need to implement something on the USB device side as well.
Thank you in advance.

webcam interfacing with stm32

I want to use the STM32F4 microcontroller to receive a video stream then stream it over ethernet with the rtsp protocol .
I need you guys to tell me wich circuit would be the best for interfacing with STM32.
Can I interface a webcam with the STM32 via the USB OTG ? (I have basic ideas about usb protocol, but the problem is that the webcam I have is not supported by linux so there is no code source for the drivers, so no Endpoint references ...)
Is it possible to define Endpoints and vendor-specific commands that trigger the bulk transfer of video ( streaming ) by debugging the usb traffic ?
Or, would you recommend another circuit that provide video stream simple to interface with the STM32 .
I know this is kind of crazy thing to do, but I'm asking how hard it's gonna be ?
Let me know what you think of this project ?
PS:
The rtsp part of the project is not the purpose of this topic .
Thanks in advance.
You can't easily run linux on an STM32F4, nor is getting a USB stack running on it, and writing your own webcam driver trivial. I would recommend going with some sort of embedded camera, or moving up to a processor that can support a full linux distro running on it.
As stbtrax mentioned the STM32F4 processor cannot really handle video processing, so your best to move to an embedded OS system such as Odroid.
Another option is to interface a camera direct to STM32F4 using DCMI and then stream theis over USB using UVC as this guy has done. You will be limited with resolution here.
https://github.com/iliasam/STM32F4_UVC_Camera

Is it possible to determine usb protocol from an installed driver?

Just as the question states, the goal is to reverse engineer the protocol used by a device.
Let's say you have a webcam, an Arduino and an Arduino USB Host shield. You want to talk to that webcam, from which you don't know the protocol. Can it be done by monitoring USB data packets and by analyzing the driver installed for that device?
It would be a really interesting project.
Thanks in advance.
I often use a serial spy program to look at the conversation between two devices. In windows you can pay for it...
http://www.sinnovations.com/htdocs/serial-port-monitor.htm
In Linux it's free...
http://www.cyberciti.biz/faq/howto-monitor-data-on-a-serial-port-in-linux/