Jump to content
Sign in to follow this  
FaT3oYCG

XBOX 360 Chatpad Adapter Driver (Test)

Recommended Posts

FaT3oYCG

Hi, I have recently been looking into making a driver for the XBOX 360 Chatpad so that you can use it with your PC, I am running on a Windows 7 machine and had a hell of a job installing the driver for the Controller so that I could connect to the controller but now that I have solved that issue I moved onto looking at how I could use raw input to possibly create a Driver (Sort of) for the Chatpad.

I have come up with this simple script for now to see if the adapter has the same name for other people as it is quite strange related to other HID devices that I have attached to my computer, If you could please test this script with the adapter attached and tell me if you are notified that it has been found then that would be great, I can continue myself for now working towards the driver but I want to know if it will work on other systems not just my own.

Script:

#cs ----------------------------------------------------------------------------
    AutoIt Version: 3.3.4.0
    Author:         Craig Gilhooley

    Script Function:
    XBOX 360 Controller HID Chatpad Driver.
#ce ----------------------------------------------------------------------------

; XBOX 360 Wireless Controller Adaptor Name (???)
$deviceName = "\\?\HID#{84a1e9b8-12ba-4a9c-8ab0-a43784e0d149}_LOCALMFG&0000#8&1494f40&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"

; Open the User32 dll to allow access to the raw input functions
$dll = DllOpen("user32.dll")

; If the dll could not be opened show error message
If Not $dll Then
    MsgBox(48, "Error!", "The DLL could not be opened.")
EndIf

$rid = DllStructCreate("dword;dword;")
$numDevices = DllStructCreate("int")
$retval = DllCall($dll, "long", "GetRawInputDeviceList", "ptr", 0, "ptr", DllStructGetPtr($numDevices), "long", DllStructGetSize($rid))
If @error Then
    MsgBox(48, "Error!", "Unable to obtain the number of devices, Error code " & @error)
EndIf

$numDevs = DllStructGetData($numDevices, 1)
$temp = ""
For $i = 0 To ($numDevs - 1)
    $temp &= "dword;dword;"
Next
$ridl = DllStructCreate($temp)
$dwsize = $numDevs * DllStructGetSize($ridl)
$retval = DllCall($dll, "long", "GetRawInputDeviceList", "ptr", DllStructGetPtr($ridl), "ptr", DllStructGetPtr($numDevices), "long", DllStructGetSize($rid))
If @error Then
    MsgBox(48, "Error!", "Unable to obtain a list of devices, Error code " & @error)
EndIf

For $i = 0 To ($numDevs - 1)
    $devName = DllStructCreate("char[256]")
    $size = DllStructCreate("dword")
    DllStructSetData($size, 1, 256)
    DllCall($dll, "long", "GetRawInputDeviceInfo", "long", DllStructGetData($ridl, ($i * 2) + 1), "int", 0x20000007, "ptr", DllStructGetPtr($devName), "ptr", DllStructGetPtr($size))
    MsgBox(0, "Device: " & $i, _
            "Handle: " & DllStructGetData($ridl, ($i * 2) + 1) & @CRLF & _
            " Type: " & DllStructGetData($ridl, ($i * 2) + 2) & @CRLF & _
            " Name: " & DllStructGetData($devName, 1))
    If StringInStr(DllStructGetData($devName, 1), $deviceName) <> 0 Then
        MsgBox(64, "Search Stopped!", "The Chatpad adaptor was found.")
        $chatpadHandle = DllStructGetData($rid, ($i * 2) + 1)
        $i = $numDevs
    EndIf
Next

DllClose($dll)

Thanks,

Craig.

Edited by FaT3oYCG

Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Share this post


Link to post
Share on other sites
Richard Robertson

The chatpad isn't linked to the PC driver for the 360 controller unless they've changed it in the last few months.

Share this post


Link to post
Share on other sites
FaT3oYCG

That is correct, but to create a driver for it (Sort of) using autoit to read and write raw input and output to the controller through the adaptor requires the driver for the adaptor.


Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Share this post


Link to post
Share on other sites
Richard Robertson

So do you have some kind of documentation on what raw data comes from or goes to the chatpad?

I can check the script later today to see if the HID works here though. Are you wanting to specifically test wireless or will a wired controller do? I have both.

Share this post


Link to post
Share on other sites
FaT3oYCG

Wireless, it will check to see if the adapter is installed under the same name on your system so that it can be accessed by the raw input functions. I don't need to specifically know what comes out of the controller in raw output mode but to use the Chatpad I will need to do some testing to see how to get it to work.


Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Share this post


Link to post
Share on other sites
Richard Robertson

I'll have to find my wireless adapter first then. I'll let you know tomorrow what happens.

Share this post


Link to post
Share on other sites
Richard Robertson

I got several HIDs that appeared when I had the wireless controller and chatpad connected. However, it never triggered the chatpad adapter found message box. Is that a satisfactory response?

Share this post


Link to post
Share on other sites
FaT3oYCG

Ill have to work up another script to try and find out which one it is on yours but thanks for the response, a list of the outputs would be nice if you could :blink:


Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Share this post


Link to post
Share on other sites
Richard Robertson

I'll change the message boxes to console output and run it.

\\?\HID#{84a1e9b8-12ba-4a9c-8ab0-a43784e0d149}_LOCALMFG&0000#8&1494f40&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}

If you notice, the bold part on the end matches the end of device 0.

Device: 0
 Handle: 985095
 Type: 2
 Name: \\?\HID#VID_045E&PID_02A1&IG_00#7&1de33f33&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Device: 1
 Handle: 65599
 Type: 1
 Name: \\?\Root#RDP_KBD#0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}
Device: 2
 Handle: 720957
 Type: 1
 Name: \\?\ACPI#PNP0303#4&278ffe81&0#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}
Device: 3
 Handle: 65595
 Type: 0
 Name: \\?\Root#RDP_MOU#0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}
Device: 4
 Handle: 720953
 Type: 0
 Name: \\?\ACPI#SYN0602#4&278ffe81&0#{378de44c-56ef-11d1-bc8c-00a0c91405dd}
Edited by Richard Robertson

Share this post


Link to post
Share on other sites
FaT3oYCG

Thanks for your findings, I have been very busy at work etc. so haven't had time to look at this, I will try and work on it for a bit now and see what comes of it, someone recently linked me to some more information about how the Chatpad seems to send and receive data via the pc but I need to set that up first as I was trying to get the adapter to be recognised first ;).


Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Share this post


Link to post
Share on other sites
makeasy

hello FaT3oYCG,

did you make progress with the script? I'm very interested to use the chatpad on pc for example surfing in the internet from the couch or playing games like on a console.

I'm not a beginner in autoit but I think to program a driver is a little too heavy for me. Maybe you can help me...There is also a UDF called_XInput.au3 or a _IsPressed360.au3. Can we use this?

regards

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×