Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

How to communicate to a USB-IRDA device using VB-6.0 through DeviceIOControl API?

Status
Not open for further replies.

CMOS

Advanced Member level 3
Joined
Jan 6, 2004
Messages
864
Helped
94
Reputation
186
Reaction score
50
Trophy points
1,308
Location
USA
Activity points
5,683
Hi,
I am trying to communicate to a USB-IRDA device using VB-6.0 through DeviceIOControl API. Can anyone tell me how to find the "DeviceName" for IRDA or any device so that I can use CreateFile API to create a handle for it and pass it to DeviceIOControl for communication. I searched the registry (HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\) but couldn't find any key named "DeviceName" under IRDA or WW-600 (My USB-IRDA dongle).
 

CMOS

Advanced Member level 3
Joined
Jan 6, 2004
Messages
864
Helped
94
Reputation
186
Reaction score
50
Trophy points
1,308
Location
USA
Activity points
5,683
communicate usb visual basic

No one knows how do I get DeviceName of any USB device?
Please help me out of this trouble. This is the first time I am accessing USB.
 

Zhasha

Junior Member level 3
Joined
Dec 3, 2005
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Denmark
Activity points
1,643
deviceiocontrol usb vb6

I'd recommend you use C++ and the DDK

but if you want to use VB6 then you still need to download the DDK, but youll also need to know the DLL names and function names. i cannot remember them out of the top of my head, but im not even sure you can make it work in VB. after all the language is rather limited

if you understand C++ then this page should be of some help: http://www.alanmacek.com/usb/

the key functions are:

VOID HidD_GetHidGuid(GUID *hidGUID)
HDEVINFO SetupDiGetClassDevs(GUID hidGUID, PSTR *filterString, hwndParent, DWORD flags)
BOOL SetupDiEnumDeviceInterfaces(infoset, infoData, interfaceClassGuid, index, deviceInterfaceData)
BOOL SetupDiGetDeviceInterfaceDetail(infoSet, deviceInterfaceData, interfaceDetail, interfaceDetailSize, requiredSize, infoData)
HANDLE CreateFile(name, access, sharemode, security, creation, flags, template)
BOOL HidD_GetAttributes(deviceHandle, &deviceAttributes)

EDIT: and lookie here, i just found this http://www.usbmicro.com/apps/appfiles.zip
it has VB modules for HID and interfacing usb
 

alzomor

Advanced Member level 2
Joined
Jun 9, 2005
Messages
678
Helped
39
Reputation
78
Reaction score
8
Trophy points
1,298
Location
Cairo
Activity points
6,417
visualbasic setupdigetclassdevs

Hi

You can check in the EDAboard books section for

USB compelete

it contains a compelte example by explanation for HID driver using the VB

Attached a source code for example using VB for driving USB

Salam
Hossam Alzomor
 

CMOS

Advanced Member level 3
Joined
Jan 6, 2004
Messages
864
Helped
94
Reputation
186
Reaction score
50
Trophy points
1,308
Location
USA
Activity points
5,683
visual basic irda usb

Those links were of great help.

One more question. Can anyone tell me if I am building a microcontroller programmer, in which USB class it will fall in? Can I use HID for that?
 

checkmate

Advanced Member level 3
Joined
Feb 25, 2004
Messages
833
Helped
178
Reputation
356
Reaction score
125
Trophy points
1,323
Location
Toilet Seat
Activity points
7,815
usb device vb6

I don't quite get why everybody is recommending HID when there was never any mention that the USB-IRDA uses the HID device class.
Anyway, how you can retrieve a handle to your device depends very much on its driver. If the driver creates a symbolic link, then you can use the pre-defined device path. The more comon method is that it registers the driver interface. Then the SetupDiGetClassDevs function allows you to retrieve the device interface of all devices from a device class. You can always find out the irda's device class from the device manager.
If you are developing your own usb device, it can be compliant to any of the device classes documented in usb.org, as long as the usb firmware satisfies all the requirements for the device class. HID is one of the easiest device classes to implement, and it does not require any driver programming. That is why it's the most popular device class to use among beginners. You can even define your own custom device class.
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top