?
Solved

talking to WinRT-USB ActiveX Dll

Posted on 2005-04-10
15
Medium Priority
?
1,070 Views
Last Modified: 2011-09-20
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.

0
Comment
Question by:HubrisSonic
  • 9
  • 4
14 Comments
 
LVL 5

Expert Comment

by:Rimscorp
ID: 13752705
WinRT uses a fundamentally different approach than
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(hWinRT, _WinRTpp02,
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
0
 

Author Comment

by:HubrisSonic
ID: 13758776
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.

0
 
LVL 5

Expert Comment

by:Rimscorp
ID: 13762711
OHHHHHHHHHHHHHHHHHHHH   K    

Here is a step by step whitepaper

P.s you need adobe


http://www.programmable-products.com/ppidriver.pdf

 
                                                      -James
0
 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

 

Author Comment

by:HubrisSonic
ID: 13768876
Adobe? fer what?
0
 

Author Comment

by:HubrisSonic
ID: 13768891
oh... to view the file... never mind
0
 

Author Comment

by:HubrisSonic
ID: 13769975
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_RECIPIENT RequestRecipient , System.Byte Request , System.Int16 Value , System.Int16 Index , System.Int32 HostToDevice , System.Int32 Length , System.Byte Buffer )
void GetConfigurationDescriptor ( WINRTUSBLib.ConfigurationDescriptor ConfigDescriptor )
void GetDeviceDescriptor ( WINRTUSBLib.DeviceDescriptor DeviceDescriptor )
void GetEndpointDescriptor ( System.Byte Endpoint , WINRTUSBLib.EndpointDescriptor EndpointDescriptor )
void GetInterfaceDescriptor ( WINRTUSBLib.InterfaceDescriptor 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.IsochronousTransfer Transfer )
void SelectInterface ( System.Int32 Interface , System.Int32 AlternateSetting )
int DeviceInstance [  get,  set ]
string LinkName [  get,  set ]

Does Anybody now how to use this?

0
 
LVL 5

Expert Comment

by:Rimscorp
ID: 13771642
Is it not using PPI USB dll as an example ?
0
 

Author Comment

by:HubrisSonic
ID: 13773357
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.

0
 

Author Comment

by:HubrisSonic
ID: 13778743
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?


0
 
LVL 5

Expert Comment

by:Rimscorp
ID: 13781142
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
0
 

Author Comment

by:HubrisSonic
ID: 13800170
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.
0
 

Author Comment

by:HubrisSonic
ID: 13803536
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,0xC0000000,0x3,0x0,0x3,0x40000000,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,IOCTLVALUE,InBuffer,8,OutBuffer,64,&nBytesRead,&OverlapStruct);

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(OverlapStruct.hEvent,INFINITE) != WAIT_OBJECT_0) { // wait for the read to finish
                        !GetOverlappedResult(USB,&OverlapStruct,&dwBytesReturned,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.



0
 

Author Comment

by:HubrisSonic
ID: 13803540

Can I get these points refunded to me?
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 14021602
PAQed with points refunded (125)

modulo
Community Support Moderator
0

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to use a free utility called 'Parkdale' to easily test the performance and benchmark any Hard Drive(s) installed in your computer. We also look at RAM Disks and their speed comparisons.
If you're a modern-day technology professional, you may be wondering if certifications are really necessary. They are. Here's why.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month17 days, 6 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question