HubrisSonic
asked on
talking to WinRT-USB ActiveX Dll
I have a device that uses an old WinRT-USB driver, does anybody know the sequence to open the device, write some data to one of the pipes and read the result from another pipe? I dont want to buy a Jungo Driver toolkit.
I know the Vendor ID, etc. and the interface numbers I want to write to. and what data I want to write.
I know the Vendor ID, etc. and the interface numbers I want to write to. and what data I want to write.
ASKER
Okay, thats interesting stuff.... however, I should clarify, i actually dont want to talk to the device, I want WinRT to do that. my intent is
1. Use ActiveX WinRT USB Dll from whatever, C, C++,VB
2. Send "GETU00000" to the device (through WinRT), pipe 0x01
3. Get data back from the device (through WinRT), pipe 0x82
my questions relate to how to talk to the WinRT device driver. and how to get it to pass data to and from the device.
1. Use ActiveX WinRT USB Dll from whatever, C, C++,VB
2. Send "GETU00000" to the device (through WinRT), pipe 0x01
3. Get data back from the device (through WinRT), pipe 0x82
my questions relate to how to talk to the WinRT device driver. and how to get it to pass data to and from the device.
OHHHHHHHHHHHHHHHHHHHH K
Here is a step by step whitepaper
P.s you need adobe
http://www.programmable-products.com/ppidriver.pdf
-James
Here is a step by step whitepaper
P.s you need adobe
http://www.programmable-products.com/ppidriver.pdf
-James
ASKER
Adobe? fer what?
ASKER
oh... to view the file... never mind
ASKER
Actually the ppidriver.pdf describes how to use the PPI USB dll, not the WinRT lib. again, i dont want to spent $1,000 for programmable products software.
Here is the interface exposed by the WinRT ActiveX DLL.
System.Int32 BulkTransfer ( System.Byte Endpoint , System.Int32 Length , System.Byte Buffer )
void ClearStall ( System.Byte Endpoint )
System.Int32 ControlTransfer ( WINRTUSBLib.REQUEST_TYPE RequestType , WINRTUSBLib.REQUEST_RECIPI ENT RequestRecipient , System.Byte Request , System.Int16 Value , System.Int16 Index , System.Int32 HostToDevice , System.Int32 Length , System.Byte Buffer )
void GetConfigurationDescriptor ( WINRTUSBLib.ConfigurationD escriptor ConfigDescriptor )
void GetDeviceDescriptor ( WINRTUSBLib.DeviceDescript or DeviceDescriptor )
void GetEndpointDescriptor ( System.Byte Endpoint , WINRTUSBLib.EndpointDescri ptor EndpointDescriptor )
void GetInterfaceDescriptor ( WINRTUSBLib.InterfaceDescr iptor InterfaceDescriptor )
void GetLanguageIds ( System.Int16 NumberOfIds , System.Int16 LanguageIds )
System.Int16 GetNumberOfLanguageIds ( )
System.String GetStringDescriptor ( System.Int16 LanguageId , System.Int32 DescriptorIndex )
System.Int32 InterruptTransfer ( System.Byte Endpoint , System.Int32 Length , System.Byte Buffer )
void IsochronousTransfer ( System.Byte Endpoint , WINRTUSBLib.IsochronousTra nsfer Transfer )
void SelectInterface ( System.Int32 Interface , System.Int32 AlternateSetting )
int DeviceInstance [ get, set ]
string LinkName [ get, set ]
Does Anybody now how to use this?
Here is the interface exposed by the WinRT ActiveX DLL.
System.Int32 BulkTransfer ( System.Byte Endpoint , System.Int32 Length , System.Byte Buffer )
void ClearStall ( System.Byte Endpoint )
System.Int32 ControlTransfer ( WINRTUSBLib.REQUEST_TYPE RequestType , WINRTUSBLib.REQUEST_RECIPI
void GetConfigurationDescriptor
void GetDeviceDescriptor ( WINRTUSBLib.DeviceDescript
void GetEndpointDescriptor ( System.Byte Endpoint , WINRTUSBLib.EndpointDescri
void GetInterfaceDescriptor ( WINRTUSBLib.InterfaceDescr
void GetLanguageIds ( System.Int16 NumberOfIds , System.Int16 LanguageIds )
System.Int16 GetNumberOfLanguageIds ( )
System.String GetStringDescriptor ( System.Int16 LanguageId , System.Int32 DescriptorIndex )
System.Int32 InterruptTransfer ( System.Byte Endpoint , System.Int32 Length , System.Byte Buffer )
void IsochronousTransfer ( System.Byte Endpoint , WINRTUSBLib.IsochronousTra
void SelectInterface ( System.Int32 Interface , System.Int32 AlternateSetting )
int DeviceInstance [ get, set ]
string LinkName [ get, set ]
Does Anybody now how to use this?
Is it not using PPI USB dll as an example ?
ASKER
Thanks for all your time on this Rimscorp,
No, its not using PPI USB, i have WinRT installed as the driver.
i have made some head way and am Opening the device and also getting the DeviceIoControl to almost work. (really close), next i have to figure out how to load up a write to the device of "GETU000000" and get the result.
i am not using any of the calls i posted above, but am working with the rwbulk.c sample from the DDK.
No, its not using PPI USB, i have WinRT installed as the driver.
i have made some head way and am Opening the device and also getting the DeviceIoControl to almost work. (really close), next i have to figure out how to load up a write to the device of "GETU000000" and get the result.
i am not using any of the calls i posted above, but am working with the rwbulk.c sample from the DDK.
ASKER
Rimscorp, i am just guessing, but if i have the "handle" of the device from the CreateFile, how can i attach it to the instance of the WinRT driver?
do i set DeviceInstance? or LinkName? of the ActiveX, or both?
do i set DeviceInstance? or LinkName? of the ActiveX, or both?
The 2 are different.
Read up
Linkname is http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_wmiref_pr_ExchangeQueueLinkName.asp
Device instance is http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_m_Summer_04/directx/ref/ns/microsoft.directx.directinput/s/deviceinstance/deviceinstance.asp
-James
Read up
Linkname is http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_wmiref_pr_ExchangeQueueLinkName.asp
Device instance is http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_m_Summer_04/directx/ref/ns/microsoft.directx.directinput/s/deviceinstance/deviceinstance.asp
-James
ASKER
Now i am getting somewhere, I am using DeviceIoControl, and then waiting for the overlapping event to finish. I am off to test my latest code on the device.
ASKER
talking to a device in user-mode is not trivial, you have really follow the correct dance steps, as follows...
Open your device
USB = CreateFile(devName,0xC0000 000,0x3,0x 0,0x3,0x40 000000,0x0 );
Create a OVERLAPPED structure, and make sure you create an event for it, AND zero out the DWORD fields.
OverlapStruct.hEvent = CreateEvent(NULL,TRUE,TRUE ,NULL);
OverlapStruct.Internal = OverlapStruct.InternalHigh = 0;
OverlapStruct.Offset = OverlapStruct.OffsetHigh = 0;
SetLastError(NO_ERROR);
Call your DeviceIoControl
rtn = DeviceIoControl(USB,IOCTLV ALUE,InBuf fer,8,OutB uffer,64,& nBytesRead ,&OverlapS truct);
now... you have to first.. check the return code on the DeviceIoControl, if its not 0 then, call GetLastError(), If its ERROR_IO_PENDING, thats okay.
if(GetLastError() == ERROR_IO_PENDING) { //
if(WaitForSingleObject(Ove rlapStruct .hEvent,IN FINITE) != WAIT_OBJECT_0) { // wait for the read to finish
!GetOverlappedResult(USB,& OverlapStr uct,&dwByt esReturned ,FALSE)
}
You should have your data now...
using the DeviceDriver's exported functions arent necessary, just open the driver and use the DeviceIoControl, or ReadFile/WriteFile, depending on the style of Kernel Mode Driver thats used.
Open your device
USB = CreateFile(devName,0xC0000
Create a OVERLAPPED structure, and make sure you create an event for it, AND zero out the DWORD fields.
OverlapStruct.hEvent = CreateEvent(NULL,TRUE,TRUE
OverlapStruct.Internal = OverlapStruct.InternalHigh
OverlapStruct.Offset = OverlapStruct.OffsetHigh = 0;
SetLastError(NO_ERROR);
Call your DeviceIoControl
rtn = DeviceIoControl(USB,IOCTLV
now... you have to first.. check the return code on the DeviceIoControl, if its not 0 then, call GetLastError(), If its ERROR_IO_PENDING, thats okay.
if(GetLastError() == ERROR_IO_PENDING) { //
if(WaitForSingleObject(Ove
!GetOverlappedResult(USB,&
}
You should have your data now...
using the DeviceDriver's exported functions arent necessary, just open the driver and use the DeviceIoControl, or ReadFile/WriteFile, depending on the style of Kernel Mode Driver thats used.
ASKER
Can I get these points refunded to me?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
other products by using a preprocessor to convert special sections of the WinRT application
into driver commands so that an entire sequence of commands is actually executed at driver level
(Ring 0). For example, the sequence:
outpb( CMOS_ADDR, reg );
stall( 20 );outpb( CMOS_DATA, val );
stall( 20 );
is converted by the preprocessor into:
WINRT_CONTROL_ITEM _WinRTpp02[] =
{// command param1 param2
{OUTP_B, 0, 0},
{STALL, 0, 20},
{INP_B, 0, 0},
{STALL, 0, 20},
};
_WinRTpp02[ 0].port = CMOS_ADDR;
_WinRTpp02[ 0].value = reg;
_WinRTpp02[ 2].port = CMOS_DATA;
if (!WinRTProcessIoBuffer(hWi
sizeof(_WinRTpp02), &iWinRTlength))
goto localError;
*val = _WinRTpp02[ 2].value;
This approach is more efficient than the one used by the other toolkits, which requires a call into
the driver for each port access.
:D