USB anschluss bestimmen
-
hallo zusammen!
ich habe ein problem mit folgender konfiguration:
http://gemini-sites.de/wandlerProblem.gif
wie kann ich in meinem c++/wxWidgets programm herausbekommen, welcher ad-wandler zusammen mit dem USB-To-RS485 Converter an einem Kabel hängt?den converter spreche ich über CreateFile an, die ad wandler über einen national instruments treiber.
danke!
-
kann man auf diese ebene von windows überhaupt nicht zugreifen?
-
Dieser Thread wurde von Moderator/in SeppJ aus dem Forum C++ (auch C++0x und C++11) in das Forum WinAPI verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.
-
Die VID und PID lassen sich sicher herausbekommen.
Habe per google sowas gefunden, habs aber nicht getestet!
SP_DEVICE_INTERFACE_DETAIL_DATA *pDetData = NULL; DWORD dwDetDataSize = sizeof (SP_DEVICE_INTERFACE_DETAIL_DATA) + 256; pDetData = (_SP_DEVICE_INTERFACE_DETAIL_DATA_A*) malloc (dwDetDataSize); pDetData->cbSize = sizeof (SP_DEVICE_INTERFACE_DETAIL_DATA); bOk = SetupDiGetDeviceInterfaceDetail (hDevInfo, &ifcData, pDetData, dwDetDataSize, NULL, &devdata);
pDetData->DevicePath contains VID and PID in string form (eg. VID_xxxx&PID_xxxx), or you can use HidD_GetAttributes function in HID.DLL to extract these to a structure:
typedef struct _HIDD_ATTRIBUTES { ULONG Size; USHORT VendorID; USHORT ProductID; USHORT VersionNumber; } HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES;
Die Speichergroesse ist falsch implementiert, der Rest könnte aber funktionieren.
siehe Doku:
http://msdn.microsoft.com/en-us/library/windows/hardware/ff551120(v=vs.85).aspx
Using this function to get details about an interface is typically a two-step process:
1.Get the required buffer size. Call SetupDiGetDeviceInterfaceDetail with a
NULLDeviceInterfaceDetailData pointer, a DeviceInterfaceDetailDataSize of zero,
and a valid RequiredSize variable. In response to such a call, this function
returns the required buffer size at RequiredSize and fails with GetLastError
returning ERROR_INSUFFICIENT_BUFFER.2.Allocate an appropriately sized buffer and call the function again to get the
interface details.
-
vielen dank, das sieht sehr vielversprechend aus! ich werde das montag mal testen.
-
ich habe es jetzt hinbekommen. es war nicht trivial, letztendlich habe ich diesen quellcode angepasst und rekursiv alle usb hubs/devices durchsucht:
http://mtpretag.googlecode.com/svn-history/r3/trunk/c-source/jusbpmp_native_source/displayusb.c
danke für eure antworten!