Writing Custom USB descriptors - c

I am working on a CX3 chip from cypress which has a USB 3.0 connectivity. I need to enumerate the USB to work as a UVC class(video class) and as a serial port simultaneously.
I have seen the USB documents related to the same but those don't clearly explain about how to write one.
The CX3 SDK provides help to generate the USB descriptors for a UVC class but that doesn't give info about how to add the COM port features into it.
So my query is how do you write the descriptor for the same.
Thanks in advance.

Refer to the attached project in this knowledge base article from Cypress - "Using CyU3PDebugPrint API to Send Debug Messages over USB-CDC Interface from FX3 Firmware – KBA231478"
This is a modified version on AN75779. You can compare this project with the original AN75779 appnote firmware available here to see the additions done for adding USB-CDC support in a UVC device.
Hope this helps!

Related

develop BLE peripheral using C on intel edison

I am trying to develop a bluetooth LE peripheral in intel-edison, by using C library. The device should be able to :
advertise (GAP)
accept connection (GAP)
support custom GATT service, simply read/write value of characteristic.
I try to use HCI and bluez to implement this. bluez-experiments, intel-edison-playground, which demonstrate how to advertise and scan, can be compiled and run on edison. BLE advertising and scanning do work.
But I have hard time to figure out how to accept connection and support GATT service. I try to search on goolge about the HCI document but have no luck. Can someone provide a snippet of code (c or pseudo or a description)?
Thank you so much!
Andrew
If you download the bluez source you'll find documentation on the hci protocol in /doc/mgmt-api.txt. I'm not using the hci interface myself, and I'm not sure if the developers intend for implementors to use this interface to implement peripherals, so I'm not sure how well this will work.
I went with the DBus API approach for my project, which is outlined in /doc/gatt-api.txt and /doc/advertising-api.txt. This approach involves writing a program which creates DBus objects which support specific org.bluez DBus interfaces (GattService1 which contains GattCharacteristic1 and GattDescriptor1) and the ObjectManager interface to expose everything to bluez. You then use LEAdvertisment1 to define what is advertised and register the advertisement using the LEAdvertisingManger1 interface on the adapter.
I used Qt to simplify the DBus communication parts.
The DBus API for BLE on bluez is still in heavy development, and not all features are supported (I still haven't found a way to start and stop advertising, for example). 5.31 contains a lot of added supported and some critical bug fixes for descriptors, but requires a newer kernel.

establish bluetooth piconet connection between server and two clients using c on linux platform?

I want to establish Bluetooth network where one server can communicate to two clients (ie piconet) using C programm on linux platform, rfcomm based communication.
Can any one please share your guidance or sample source code if have.
I newbie to the bluetooth technology, have not found any useful info or code from internet source so far. so please.
Thank you
Basu
Linux runs open source BlueZ Bluetooth Stack, which works quite well (unless you need Bluetooth Low Energy). You can check out this tutorial: http://people.csail.mit.edu/albert/bluez-intro/c404.html
PS. Mind the GPL license when using #include like in those examples.
Edit:
As for creating piconet specifically, I'm afraid I don't have any snippets. However, after quick search, I would look into using bluez library to open not one but many RFCOMM sockets. So you can listen to and accept multiple connections.

Communicating to USB Device

I bought a usb otoscope from the internet and I want to create an application that uses it. When I plug it into the computer, it reads the device as a USB Camera, and I can use the very barebones software supplied to communicate with it. I'm very new to the idea of communicating with usb all together. I've tried to look at some sites like this: http://www.jespersaur.com/drupal/book/export/html/21, that tell me how to reverse engineer a device. I don't know if I'm going down the right path with this...
I've downloaded USB Snoopy and I can't seem to get it to sniff the packets correctly. I also have Crunchbang linux installed on a different computer but I don't know how to sniff it on that either (especially because the drivers are native to windows). All I want is some sort of API/Interfacing functions for me to call and use. How do I go about doing such a thing? I'm able to locate the device on the device manager in windows, and it tells me hardware ID's and such. I can supply any information if necessary. Thank you.
EDIT - Small description I found of the otoscope: http://microscopesimgv.blogspot.com/2012/08/oasis-ehev2-usbplus-20mp-handheld-usb.html
would this tool help you any?libusbx is a cross-platform user mode library that provides generic access to USB devices
CHEERS!

How to write DD-WRT C app?

I want to write a small proxy as a user-level program for the DD-WRT environment.
The proxy will read/write between a USB HID device (Arduino) attached to the DD-WRT box and a specific web server. The USB device will use an AT-style code. The web server uses HTTP.
I'm new to the DD-WRT environment.
Pointers to useful sample apps, GIT repos, blog posts, etc would be appreciated. Anything about getting started writing a DD-WRT app.
Googling has not been successful.
More Googling and reading has led me to:
Apparently, OpenWRT packages can be loaded onto DD-WRT systems. "Note that you can install any OpenWRT package, using ipkg." -- from a DD-WRT page
An intro to writing an OpenWRT package.
http://www.dd-wrt.com/wiki/index.php/Development
If you want to write a kernel module for DD-WRT, this seems like a good start.
DD-WRT has packages for many useful things. Python and pyserial struck my attention.
It is trivially easy to write a HTTP server in python. It is equally easy to interface with a serial port in python.
Load kernel drivers for the USB serial emulator chip on your Arduino (mine has a FTDI chip). It will manifest itself as /dev/ttyUSB0 or something. Do everything else in python.

USB blocking using minifilter driver (passThrough)

I am writing a mini-filter code for USB (Flash Drives) for blocking i.e (Access Denied).So, could someone help me out, how to detect or block USB or what methods to use in passThrough WDK sample code for USB detection and USB blocking?
I am trying to use *IOCTL_STORAGE_QUERY_PROPERTY in PFLT_INSTANCE_SETUP_CALLBACK*. Am i on right path?? if yes then how to use IOCTL_STORAGE_QUERY_PROPERTY in PFLT_INSTANCE_SETUP_CALLBACK???
After 3 months of work I have finally achieved blocking.
Though I can't give direct code here.
But following link might help.
PassThrough Development
GitHub Link
One way could be to get the device object using FltGetDiskDeviceObject and then check for FILE_REMOVABLE_MEDIA flag in device_object->Characteristics. Once you get to know about the device type, then you can block or allow the required operations (that you need to register with FLT_OPERATION_REGISTRATION).

Resources