Please advice me, is there any built in function to retrieve "PID" and "VID" when USB is hooked up to the system? If not, what is the best way to get USB "HID" and "PID"? I need these two to detect USB HID device.
Since your tag specifies C# I'm going to assume that you want to do this using Microsoft Windows.
Using Windows I find this information using Device Manager under Computer Management (right-click on My Computer and select Manage). Using View -> Devices by connection open up the PCI bus node and then all of the USB nodes until you find the device you are looking for. Below is an example from my PC showing three USB devices on Intel(R) 82801G (ICH7 Family) USB Universal Host Controller entries.
Then look at the properties of the device -> then details -> then select property hardware ids and you should get the VID and PID of the device.
Don't know about native .NET, I only used LibUsbDotNet so far, check the examples.
Usually you would install the .NET assembly from the sourcefourge page, add the assembly to your Visual Studio project (References/.NET) and follow the examples (LibUsbDotNet Example Code/Getting Startet Example). Details depend on your C#/.NET/Visual Studio versions.
Related
In an effort to automate some phone calling processes and integrate TAPI3 with another application, I am using to following code that was found as a sample;
tapi = new TAPI3Lib.TAPIClass();
tapi.Initialize();
foreach (TAPI3Lib.ITAddress ad in (tapi.Addresses as TAPI3Lib.ITCollection))
cbLines.Items.Add(ad.AddressName);
This code fills the devices in a dropdown and the dropdown only contains one device and it only shows from my computer. I tried installing the PIMphony_6.8_bld3200_XX_Alcatel on other computers where i add the IP address of the PBX device and a phone number (ex: 106) but it does not even show in the list the one device that i can see on my computer. I whatsoever have no idea what and how i managed to be able to see the device on my computer when i run this code. Obviously i am missing something. The devices we are using are Alcatel and the phone can be controlled by this app only on my computer. (i can provide the zip file containing PIMphony_6.8_bld3200_XX_Alcatel if needed). So the ultimate goal is to be able to see telephone lines on all computers so we can control them from the computer.
What am i missing Tapi3 experts? is it a missing installation on the other pc's ? and why only my device shows up?
You need a 3rd party TAPI driver installed, it might be on a DVD with the PBXor on some support website, but some manufacturers charge extra for it. This PIMphony looks like a phone control tool but that does not guarantee it is using TAPI under the hood, it may be using some propitiatory protocol.
I don't know TAPI3 but if you use TAPI correctly you should see 3 to 4 standard windows builtin devices (like WAN miniports) even if you have no drivers installed.
You need a decent test tool to compare results with, I would recommend phone.exe, it is kind of the standard test tool in the TAPI business. But it's getting harder to find online these days, here is a link to a slighly extended variant that google got me quickly: https://helpdesk.estos.de/Knowledgebase/Article/View/82/3/howto-ephoneexe--tapi-test-tool
This is not WinRT application. It's standard WPF. The device behaves as normal Windows PC, has Windows 10 installed. It has 3G broadband modem and a SIM card slot.
Some more information would be helpful. For example the brand and connection type (usb/internal).
If I understood you correctly you are looking for a solution to programmatically (in wpf) collect information (imei) about connected modems (in general or only one specific?)
Depending on the device you have several options.
Option 1 WMI:
Depending if the manufacturer included the information you might be successful by an simple WMI query.
To verify this take a look at the Device Manager (start -> run -> devmgmt.msc)
Right Click on your Modem -> Properties
Now go the register "Details".
Scroll through the Properties and look for your IMEI (the property doesn't necessarily is named IMEI). If you find it there, you can use a WMI Query to get the information into your WPF program.
Example here: http://www.codeproject.com/Questions/448125/How-to-write-WMI-Query-to-find-USB-MODEMS-IN-Cshar
Option 2 AT Commands:
If you are able to communicate with the modem over serial connection you can use so called "AT-Commands" to get the IMEI.
Information about the AT Commands can be found here: http://www.developershome.com/sms/atCommandsIntro.asp
I'm trying to connect to FT232R USB UART device using Windows Runtime Component for Windows Store application. Unfortunately, nothing seem to work.
My device has a vid of 0x0403 and a pid 0x6001 which seem pretty standard for this type of the device.
I tried this approach but in my case the ClassCode and SubClassCodde are both 0x00 respectively and InterfaceClassCode and InterfaceSubClassCode are both 0xFF. All this data comes from the USB view utility.
Using selector based on these class and subclass codes no device is found by DeviceInformation.FindAllAsync(selector). Also selector created based on vid and pid does not find any device.
Without the selector the device is found but I receive null in UsbDevice.FromIdAsync(serviceInfo.Id).
I also tried the FTDI approach. I downloaded the FTDI drivers and referenced the FTDI.D2xx.WinRT.winmd and FTDI.D2xx.WinRT.USB.winmd. I used the approach documented in this PDF but FTDI.D2xx.WinRT.FTManager.GetDeviceList() returns empty list.
The DeviceCapabilities are defined as they should according to documentation I found:
<Capabilities>
<m2:DeviceCapability Name="usb">
<!--FT232AM, FT232BM, FT232R and FT245R Devices-->
<m2:Device Id="vidpid:0403 6001">
<m2:Function Type="name:vendorSpecific" />
</m2:Device>
</m2:DeviceCapability>
</Capabilities>
What am I doing wrong?
Well, after long hours of fighting I found the solution. Posting it here in case anyone will need it in the future.
First of all, you should follow the official FTDI guide to install FTDI drivers from here.
You will need to remove default drivers installed by Windows for your device.
Do it this way:
It's important to check the "Delete the driver software for this device" checkbox.
Do so for Serial controller also:
Afterwards disable Windows automatic drivers installation as described here.
Then scan for hardware changes in the Device manager and you'll see the unrecognized device.
Install drivers for it manually.
Afterwards you'll see your device under Universal Serial Bus devices and not controllers.
Now your device will be fully accessible using the FTDI API.
Here is a link to API guide in case you need it. It also has an explanation on how to install correct FTDI drivers.
I am looking into making a c# program that will read in the logcat output from an android device and read it in to the c# program.
Initially it should do this while the phone is connected and it shouldn't require a specific app on the phone to be installed for the c# program to be able to retrieve the logcat output. Also the phone shouldn't require root access.
Is this something that is possible, I can't find anything on Google that says its possible but thought I'd ask on here in case someone has some useful information.
Thanks for any help you can provide
The most practical answer is to execute the shell command 'adb logcat' from your C# program and capture its output.
The only requirement for the device is that USB debugging be enabled in the settings menu.
The host PC will require that the android developer tools and appropriate USB driver for the device be installed. This can, unfortunately involve a substantial amount of hassle, especially finding the right drivers for windows hosts.
More complicated approaches would be to duplicate the functionality of the adb program (it is open source) and/or USB driver in your program, or to install an app on the device with the read logs permission which sends them to you - or even run an ssh server under the app userid so you can connect in and obtain them.
I have a device and the drivers for this device. What I would like to do is build an application that mocks a USB device to communicate with a third party application.
More specifically, I am attempting to build an application that can mock a USB device that mimics a Microsoft Zune. I want to make it so my application can register as a zune device and then communicate with the client. I have added several DLL's to my application in order to attempt to determine the calls that tell the software a connected device is a legitimate zune, but so far I haven't had much luck.
I'm new to this type of development - that is mimicking hardware devices, and I'm not very experienced in importing dll's that were written in C/C++. I am using Visual Studio 2010 (.net 4.0) to develop my app, and I would appreciate any help anyone can offer me towards mimicking the hardware. I do have the device drivers, which Visual studio refuses to reference directly. I also have an actual physical device, so I can see what the drivers are that it uses in Device Manager.
The goal is as follows
Application registers itself as a usb device, mimicking a Microsoft Zune in a similar fashion to how Virtual Clone Drive mimics a DVD player.
Application is recognized by zune client as a valid microsoft zune.
Zune Software works with application as it does the hardware device (syncing, etc)
I just found something called the Device Simulation Framework, which might be exactly what you need. It will still require significant research into how USB works to finish your solution, though. And probably still typically done using C or C++.
The Zune uses a modified version of the MTP protocol called MTPZ, but I found this sample using the Device Simulation Framework to simulate a regular MTP device. It's called The MTP Device Simulator. I can't tell if source code is available.
Are you able to replace the DLLs used by the zune client software with your own DLLs? In that case, you could wrap the original DLLs with your DLLs and intercept the operations.
Update: To find out the signatures of the functions in the DLL, take a look at the Dependency Walker tool, which will list the exported functions (and lots of other information). I'm guessing you will want to write your replacement DLL in C.
Otherwise, you'll have to write drivers that register a USB device with the proper endpoints. I'm not sure how to do this on Windows - I've only done USB coding on the firmware side, not the driver side. You should be able to use any tutorial for creating a Windows USB driver, like Getting Started with USB Driver Development
Zune specifics information might also be useful. Perhaps this blog post and its sequels could help: Inside the Zune/USB Protocol: Part 1