USB packet and data buffer capture - api

I need a software or application with API support to capture USB packet and data buffer. I would like to analyse the captured data using LabVIEW.
Suggest applications for usb packet and data capture with API support, so that I can access them using LabVIEW.
Or
Alternate methods to capture and analyse usb data using LabVIEW
I had tried a approach using logman.exe . But that doesn't log all the USB packets. Has anyone tried logman to capture the usb packets?

you can consider using VISA functions.
A few examples are shipped with Labview (open example finder and look for USB).
Here is a starting point giving instructions about how to give VISA access to the device.

You need find out some windows dll's and use it in labview. the examples provided for NI USB devices.

Related

STM32 HAL USB CDC Control Data Decoding / Open Port Detection

I get lost trying to figure out how to parse control data in CDC_Control_FS() function. Can you point me any documentation about that?
Background:
I am using stm32f103, trying to implement USB CDC communication with HAL libraries. I need to detect if usb port is opened by PC, it should handle power on scenario as well as cable reconnetion during runtime. After some research I think that checking DTR signal may be the (most elegant) solution. I know there is CDC_Control_FS() function that delivers all line configuration to stm32f103 from PC driver, but unfortunately I don't know data format / how to extract DTR signal, to be able to set some flag for indicating that usb port is currently open or closed.

USB device design for an embedded MCU

I am working on a product with an LPC1788 which needs the following USB features:
Firmware download (from host PC to device, not through a USB
key).
File upload (from device to host).
Ideally we'd also be able to get some information from the device like serial number etc.
The device should only work with a custom Windows application, so simply using a mass-storage device as-is will not do. There are quite a lot of data to upload (200MB +), so using USB bulk transfers seem necessary to me.
What is the best way to approach this? I imagine I would need to create some sort of USB composite device(?). However, I was hoping to use nxpUSBlib or winUSB so I don't have to go through the Windows driver validation process.... What are my options? Perhaps there some way to make the mass-storage device invisible for Windows?
Thanks!
Dirk
I think you'll definitely want to go with a vendor specific bulk device and you can easily use WinUSB for all of this. This should be sufficient for everything you've specified here.
For your firmware loader I'd recommend looking at the DFU (device firmware update) specification. You'll probably want make some command for your device that when sent will cause it to reenumerate itself in to DFU mode for update (rather than a composite device that is always exposed - this restricts the issue of the other interface being in use while you're flashing your device). Then you can flash it and reset it so it will reenumerate as your vendor specific bulk device again.
I wouldn't recommend mucking with mass storage, from your requirements it will be better to implement your own protocol and create some application or DLL that consumes the WinUSB API to communicate with your device, including the firmware update.

zte voice modem problem

we are using zte usb modem. we try to call by AT command (ATD) successfully. But there is no sound when remote device answered.
Does anyone have any idea?
My problem was associated with ZTE usb modem.
I solved the problem.
i can receive and send voice separately to voice port now. But i can not get clean sound like WCDMA UI.
how can i receive and send data with high quality?
Please look at my source code. [http://serv7.boxca.com/files/0/z9g2d59a8rtw6n/ModemDial.zip]
Does anyone now where is my error?
Thank you for your time.
a) Not all zte usb modems supports voice, to detect if modem supports check for ZTE voUSB Device in your ports list.
b) If port present, voice will go through it in pcm format, with 64kbps frequency (8000 samples per sec, 8 sample size).
In your own program, you should read audio stream from there.
stream is additionaly encoded with g.711, so you need to decode it before sending to audio device
It is fairly common to shut off the speaker after connection. Try sending ATM2, that should make the speaker always on.
Basic hayes command set:
M2
Speaker always on (data sounds are heard after CONNECT)
I'm trying to use asterisk's chan_dongle module on ZTE MF180 Datacard model with activated voices abilities.
Originally chan_dongle using raw PCM format on voice data.
But i was discover, that ZTE using ulaw format on sending and recciving voice data.
You can get voice data and save file in this format for learn by using standard Asterisk's Record(filename:ulaw) command in dialplan.
My voice data, dumped from ZTE modem in the same format.
I check it. ZTE dumped data was successefully played by Asterisk's command Playback(dumped)

Raw USB socket?

Does anyone know how to create a raw socket to a USB device? Like you can create raw sockets to ethernet devices, I would like to send/receive arbitrary data to a USB device.
Depends on the platform - you need a low level USB library.
Either http://sourceforge.net/projects/libusb/ or http://sourceforge.net/projects/libusb-win32/ is a good place to start
ps. It isn't a socket as such, sockets are specific to networks
You can write to the EndPoint using a Raw Socket but a certain protocol needs to be followed for the device to physically accept and reply to commands.
Depending on how the protocol is written you may be able to use a a RawSocket and some Usb sniffer to replay the data to the EndPoint but most devices employ a Timestamp and handshake process which needs to be performed dynamically for each connection and usually involves querying the device state and using the information to complete the handshake along with other information depending on the protocol of the device in question.

Voicepath GSM modem a single wave file

When a GSM modem is receiving voice(i.e., multiple wave files continuously) in the voice path, how will the modem able to identify the completion of a single wave file? Is there any software that could perform this?
The modem doesn't actually send wave files (in the sense of .wav files), because these require a header that describes how long the file is. Instead, the modem keeps sending raw data until either the call ends or the computer tells it to stop. The modem signals the end of the data with a DLE byte followed by a ! - see the wikipedia article about voice modem commands for details of this (and for how a DLE byte is sent in the datastream).
As for converting the data to .wav or another usable format: many audio conversion programs can do this; soxis one such command-line program.
A GSM mobile station may support different bearers. Depending on device capability this includes
voice
circuit switched data
packet switched data
A mobile phone typically supports voice, CS data and PS data. A GSM modem may support PS data only. Each of these bearers are implemented differently in order to utilize the radio channel effectively.
You can transport a WAV file via an packet switched bearer, however then it will be transported using IP technology. This needs an application on both endpoints handling the transport and the presentation to the user, e.g. playout.
A voice bearer supplies a continuous audio stream, starting with connecting the call and ending with terminating the call. GSM does not support discrete portions of audio on the voice bearer. Playing a WAV file on the voice bearer is a non-standard functionality for virtually all commercial devices. You may need to find test devices supporting this.
If you use the voice bearer to play out the WAV file like a normal telephone call and want to detect completion of a playout you may detect a pattern in the audio (requires an algorithm to calculate similarity since your WAV file will be encoded several times and may be mixed with noise) or use some sort of out-of-band signalling, some phones support dual mode, i.e. running voice bearer and PS bearer in parallel. Both not trivial to do.