Detecting USB in c++ - c++

iam trying to develop a tool which runs as daemon process in windows and it always tracks the usb insertion.i.e if a new usb is inserted it verifies the usb and allows the user to access,and if it is not an valid usb ,it simply don't allow the user to access it.
I have gone through all the search results i made on google but i was not able to follow,can you guys please tell ,from where should i start and even i went through MSDN .
I want to develop the tool in C++.Please help me with your suggestion and links for developing.Thank you in advance.

This information on www.codeproject.com may help your question , but it is in C# language . If you understand the steps in this example , you'll find it easy.
Detecting usb devices in windows using c#
If you know about mono framework you'll be able to port this project to run on linux environment.

Related

Transfer files from iOS device to Windows PC via USB

In my C++ Windows application, my users can plug in their mobile device via USB and my application can transfer specific files to/from the device. For Android devices, I was able to use MTP. But iOS devices have me tripped up (I'm not an iOS user).
Immediately, I saw that MTP wasn't an option as I couldn't view the device's filesystem via Windows Explorer (wasn't expecting that). So now I'm stuck, and confused. Googled like crazy and all I discovered was that other 3rd party programs can do it, but I can't find any documentation or resources as to HOW.
Can someone point me in the right direction? What would I need to do in order to view the filesystem on a connected iOS device? Are there any libraries I may be unaware of that I can't find? I can see that iTunes has the functionality I'm looking for.
Thanks for your time!
Well, it looks like my comment was wrong. There is at least libimobiledevice http://www.libimobiledevice.org/ and https://github.com/libimobiledevice/ifuse that claims to still support access to the iOS device file system and even claims to be cross-platform. I haven't tried it though to verify if those claims are true.
See also https://www.theiphonewiki.com/wiki/MobileDevice_Library for some possible alternatives

Recycle USB port in C++

I need to simulate plug/unplug for USB device in C++ under Windows environment. I know the existence of this IOCTL
http://msdn.microsoft.com/en-us/library/windows/hardware/ff537243(v=vs.85).aspx
(IOCTL_INTERNAL_USB_CYCLE_PORT) which indeed is what I am looking for, but I don't know how to use.
Is there anyone which can tell me who I can find an example or share some lines of code in order to help me, please!
Thanks in advance.
Since you are in User Mode land and using C++ I'd recommend looking at the devcon sample. Out of the box you can use it on the command line to issue PnP or disable/enable requests to devices. The source code is also available, so you can use that as a start to get this functionality added to your environment.

Windows MTP/WPD communication with Android device

I'm developing a PC c++ application running on windows. The application shall communicate with an android phone connected thru USB, using MTP. The idée is to not mount the Storage Card. What I have found is that Windows have something they call WPD (Windows Portable Device ) which supports MTP. It looks pretty ok but it demands WMP11 to be installed. What I wondering:
Is there are any other alternatives libraries you can use?
Do any one have any tips or experience about using WPD?
Are there any "leaner" dependencies you can install instead of WMP11 for xp?
Any help would be greatly appreciated.
I here provide some answers to my question for the hope that it will help some one else.
Is there any alternatives/leaner libraries?
You can use WIA but that is only used for images. but a part from that I have not found any.
Any tips?
Check out the sample code provided by Microsoft, it is a good start point. I found it be searching for Portable Devices COM API Sample on MSDN
For Services you can check out this sample code. Which I found by googling for WpdServicesApiSample
The WPD api is pretty ok to use.
Not all devices support MTP and some only support part of it. This caused me some problem but the device we used released an update which supported more of MTP
I found the answer about XP-problems from this StackOverflow by pcbbc really helpful. I can also add that we mailed the supplier and asked for a custom .INF file to support XP and they were really helpful and provided us with it. But it took some time before we got it.

Is there a Windows API to detect USB overcurrent?

I'm trying to write an application that will take specific action when it detects an overcurrent condition on any USB port.
However, my googlefu is not able to come up with anything useful (though I can now tell you 101 ways to fix a USB overcurrent problem).
Is there are standard windows API to retrieve USB status info?
If not is there another/better way to detect USB overcurrent conditions programatically?
As far as I can see here http://msdn.microsoft.com/en-us/library/ff539687 you need to turn to the WDK (Window Driver Kit).

c++ library/sample to transport voice and video over TCP/IP

Can someone point me some c++ samples or some c++ librarys that can transport video and voice over a LAN network.
My objective is to activate a web cam in another pc and receive in my pc the video and voice of the another pc (this can be only one way or in both ways pc to pc call, but i only need one way for now, only see and hear not to interact).
Thanks
If working on Windows try out the NetMeeting Resource Kit. It probably limits playing your videos with Windows Media Player only.
VNC and all its variants should be able to do it.
TightVNC Free.
Another VNC Project
I can't locate a source code link right now, but if you search with vigor it should be revealed.
WebEx's entire business was built on a forked version of VNC. Fun.