Share My Creation Control a RC plane with a joystick

blade.jpg

Here is something I did for a copter pilot who wanted to "feel" RC copters and planes as if he were flying.

So he asked me to do an interface between a joystick and his RC radio.

I built this simple usb board which can connect any USB host device and which is seen as a HID device.
The board outputs ppm signal which is a standard interface to RC radio.
carte_connectique.jpg


Now the tricky android part :
- my board is connected to the USB host plug
- the joystick is also connected to this Android usb host

The App connects to the two usb devices, reads the joystick, decommutates the values, feeds them to my board. And that's it

JoystickAndroid2ppm.jpg


[edit Xmas 2015] : Thanks to @wonder wonder(ful) generic gamepad my App should be able to read almost any joystick.

You can test it with your own joystick. If the "left" part of the screen moves, then the app should work for you too (tell me your joystick model).
The buttons can be different from one joystick to another...

The Apk is attached to this thread

Here is a video :

 

Attachments

  • JPJoystick2ppm.apk
    363 KB · Views: 854
Last edited:

Beja

Expert
Licensed User
Longtime User
Hi freedom2000,
Thanks for sharing this, but sorry I am not getting it!. will this app replace the joystick so one can control the plane without using the joystick?
 

freedom2000

Well-Known Member
Licensed User
Longtime User
Hi freedom2000,
Thanks for sharing this, but sorry I am not getting it!. will this app replace the joystick so one can control the plane without using the joystick?
No it's exactly the contrary ! (have a look to the video)
This App is there to enable the replacement of of RC radio by a Joystick.

Flying with the RC sticks is not "that" easy when you are not used to it. On the contrary pilots (real pilots) prefer flying with joysticks which is for them more immersive than the radio IF.

By the way it would be really easy to replace the joystick by a "touch UI" on the android. But flying with it is not easy (try the parot to be convinced)
 

john mad doe

Member
Licensed User
Longtime User
Bonjour freedom2000

C'est tres interessant et étant amateur de RC j'aimerais bien essayer votre systeme.

mais ou trouver la carte usb qui est utilisée pour connecter la radiocommande ?

John
 

freedom2000

Well-Known Member
Licensed User
Longtime User
Bonjour freedom2000

C'est tres interessant et étant amateur de RC j'aimerais bien essayer votre systeme.

mais ou trouver la carte usb qui est utilisée pour connecter la radiocommande ?

John

Bonjour et merci !

I go on in english if you don't mind.
I can send you an example of the board or if you prefer you could do it yourself (it's open hardware)

However you should first try your joystick with the provided apk to check if it is recognized.
If it is a Microsoft forcefeedback Pro2 or a logitech gamepad it shouldn't be a problem.
If it is another brand then you must test it and tell me the result... Most probably it won't be recognized and I will have to do modifications to my Apk to handle this new profile. We could do it together and will speak french for it

Don't hesitate to contact me by mail

Cheers
JP
 

john mad doe

Member
Licensed User
Longtime User
Hello freedom2000

Thank you for your proposition.
Well , first I have to purchase a usb hub to connect my Joystick ( Saiteck AV8R) to my Nexus 10'' and I will come back to tell you how it goes.

John

PS : where can I find your mail ?
 

freedom2000

Well-Known Member
Licensed User
Longtime User
Hello freedom2000

Thank you for your proposition.
Well , first I have to purchase a usb hub to connect my Joystick ( Saiteck AV8R) to my Nexus 10'' and I will come back to tell you how it goes.

John

PS : where can I find your mail ?
Hi John,

You can test your joystick without the hub. Just plug it into your USB host plug. As you don't have my board, only one USB slave will be connected to the bus --> the hub is not needed.

Try to connect the joystick, launch the App and tell me if you see something moving on the left part of the screen

My mail : freedom2000 at free.fr

JP
 

adrianstanescu85

Active Member
Licensed User
Longtime User
Hello

I do have a question: can I use a USB joystick connected to my Android phone and build a very very simple app that tells me that I moved the joystick left or right or pushed one button or another?

Thank you!
Adrian
 

freedom2000

Well-Known Member
Licensed User
Longtime User
Hello

I do have a question: can I use a USB joystick connected to my Android phone and build a very very simple app that tells me that I moved the joystick left or right or pushed one button or another?

Thank you!
Adrian
Hi Adrian,
Yes of course you can do that.

But there is no library to handle HID usb joystick. You will have to decommutate the descriptor of your joystick...
 

adrianstanescu85

Active Member
Licensed User
Longtime User
Hi,

Yes, that was useful. I was thinking basically to use a Logitech Extreme 3D Pro joystick just to move a few sliders inside an app. Do you think that would be compatible too like toe ForcefeedbackPro 2?

Adrian
 

freedom2000

Well-Known Member
Licensed User
Longtime User
Probably not...

To check it, just download my Apk install it and connect the joystick. If the left part of the GUI "moves" then it would be easy to update the soft. If not... noway but re code everything !
 

Jipy

New Member
Licensed User
Longtime User
Hi,

I don't see any reply to the previous comment, but, FYI, I have tried the app using the Extrem 3D Pro (Logitech) and unfortunately... it doesn't work. I'm amateur flyer and have great interrest for such application. I would have a question about the "decommutating" what do you mean exactly ? Should i investigate what is the information going trough the usb xmit, anylyse and build he approriate software on the Android side ? Or Is there any easier way to gather information about perhaps (to begin) generic HID ?

I'm sdorry if my questions have well known answer :( But, yeah, I just begin :)
Thx
Jipy
 

freedom2000

Well-Known Member
Licensed User
Longtime User
Hi,

Yes you will have to find the descriptor of your HID joystick.
They are not "public" and thus you will have to get it with a PC software like USBlyzer
After that, you can twick my code to adapt it to this descriptor
 

Jipy

New Member
Licensed User
Longtime User
Hi :)

Great informatin, thx u, i'm not used to work in depth with USB but USBlyzer "sounds" good :) to me and i will try this. I have not yet take a look to your code but i'll do asap.
So, next question: HW, it seems u use a standard controller, is it someting similar to the well known "Arduino" family circuits (i have already this my pocket:) ?

Thx
Jipy
 

freedom2000

Well-Known Member
Licensed User
Longtime User
Hi again,

Yes I use a Microchip's PIC microcontroller.
Similar to Arduino but definitively not the same environment...
 

Jipy

New Member
Licensed User
Longtime User
Thank you for the info,

I have found this "www.b4x.com/android/forum/threads/arduino-adk-introduction.27510/" very interresting as on my side i will need such kind of microcontroller connected to multiple sensors. You mentionned that i could "twick" your code, do you mean modify the "source code" (Unfortunately, i'm not sure of the translation of "twick" !) and adapt it to my particular joystick ?

If you provided the source code, could you please provide me the link ? This would be very very helpfull and i would spare a lot of time :)

Jipy
 

freedom2000

Well-Known Member
Licensed User
Longtime User
Hi

Here is the source code (Android side only)

B4X:
#Region Module Attributes
    #FullScreen: False
    #IncludeTitle: True
    #ApplicationLabel: Joystick2ppm
    #VersionCode: 1
    #VersionName: 0.00
    #SupportedOrientations: Landscape
    #CanInstallToExternalStorage: False
#End Region

Sub Process_Globals
  Dim manager As UsbManager
  Dim HIDstreams As UsbDeviceConnection
  Dim JPHIDstreams As UsbDeviceConnection
  Dim outEndpoint, inEndpoint As UsbEndpoint
  Dim JPoutEndpoint, JPinEndpoint As UsbEndpoint
  Dim device As UsbDevice
  Dim JPdevice As UsbDevice
  Dim interface As UsbInterface
  Dim JPinterface As UsbInterface
  Dim JoystickConnected As Boolean = False
  Dim JPConnected As Boolean = False
  Dim VID As Int : VID = 0x4D9
  Dim PID As Int : PID = 0x3F
  Dim JoyVID As Int
  Dim JoyPID As Int
  Dim RxPlcBuffer(64) As Byte
  Dim TxPlcBuffer(64) As Byte
  Dim Channel(8) As Int
  Dim Reverse(8) As Boolean
  Dim Input(20) As Int
  Dim Output(8) As Int

  Dim Timer1 As Timer
End Sub
Sub Globals


    Dim Bt1 As Button
    Dim PbX As ProgressBar
    Dim PbY As ProgressBar
    Dim PbZ As ProgressBar
    Dim PbR As ProgressBar
    Dim Ck1 As CheckBox
    Dim Ck2 As CheckBox
    Dim Ck3 As CheckBox
    Dim Ck4 As CheckBox
    Dim Ck5 As CheckBox
    Dim Ck6 As CheckBox
    Dim Ck7 As CheckBox
    Dim Ck8 As CheckBox
    Dim Img1 As ImageView
    Dim Ed1 As EditText

End Sub
Sub Activity_Create(FirstTime As Boolean)
    Timer1.Initialize("Timer1", 20) ' 1000 = 1 second
    Timer1.Enabled = True
    
    If FirstTime Then
        manager.Initialize
    End If
       Activity.LoadLayout("1")

  
  
       'Load the previous state
    If StateManager.RestoreState(Activity, "Main", 60) = False Then
        'set the default values

    End If
  

    For Each V As View In Activity
        If V Is Spinner Then
            If V.Tag <>"" Then
                Dim Sp As Spinner
                Sp = V
                Sp.Add("X")
                Sp.Add("Y")
                Sp.Add("Z")
                Sp.Add("Rx")
                Sp.Add("Hat")
                Sp.Add("B1")
                Sp.Add("B2")
                Sp.Add("B3")
                Sp.Add("B4")
                Sp.Add("B5")
                Sp.Add("B6")
                Sp.Add("B7")
                Sp.Add("B8")
            End If
        End If
    Next


End Sub
Sub Activity_Pause(UserClosed As Boolean)
    If UserClosed Then
        'StateManager.ResetState("Main")
        Timer1.Enabled = False
    Else
        'StateManager.SaveState(Activity, "Main")
    End If
    StateManager.SaveState(Activity, "Main")
    StateManager.SaveSettings
  
End Sub


Sub Bt1_Click
Dim NbWrite As Int
  If JPHIDstreams.IsInitialized Then
    
      TxPlcBuffer(0)= 0x83
    NbWrite = JPHIDstreams.BulkTransfer(JPoutEndpoint,TxPlcBuffer,JPoutEndpoint.MaxPacketSize,500)
    'If NbWrite = -1 Then JPConnected = False
   
  End If
End Sub


Sub Timer1_Tick

Dim NbRead As Int
Dim i As Int
Dim j As Int
Dim MyStr As String = ""

   If JoystickConnected = False Then ConnectJoystick
   If JPConnected = False Then ConnectJP
 
    If ( HIDstreams.IsInitialized = True ) Then
   
        NbRead = HIDstreams.BulkTransfer(inEndpoint,RxPlcBuffer,inEndpoint.MaxPacketSize,500)
        If NbRead = -1 Then
            JoystickConnected = False
            JPConnected = False
            Bt1.Enabled = False
        End If
        For i = 0 To NbRead -1
            j = ConvertSignedByteToUnsigned(RxPlcBuffer(i))
            'j = (RxPlcBuffer(i))
            MyStr = MyStr & NumberFormat(j,0, 0) & " "
            'Ed1.Visible = True
            'Ed1.text = MyStr
        Next
        Select (JoyVID* 0x10000 + JoyPID)    'use VID and PID as a primary key
        Case (0x45E * 0x10000 + 0x001B)        'MicrosoftForceFeedback
            DecomMicrosoftForceFeedback
        Case (0x46D * 0x10000 + 0xC216)        'LogitecDualAction
            DecomLogitecDualAction
        Case Else
            ToastMessageShow ("unsupported joystick", True)
        End Select
      
        PerformMixing                        'Apply mixing strategy

        OutputPPM                            'Send PPM command to JP Board and then to Radio
      
    End If

End Sub
Sub DecomMicrosoftForceFeedback
Dim j As Int
        j = ConvertSignedByteToUnsigned(RxPlcBuffer(1)) + Bit.AND(ConvertSignedByteToUnsigned(RxPlcBuffer(2)), 0x3)*256 +512
        j= Bit.AND(j , 1023)
        PbX.Progress = j*100/1023
        Input(0) = j * 64
      
        j = ConvertSignedByteToUnsigned(RxPlcBuffer(3)) + Bit.AND(ConvertSignedByteToUnsigned(RxPlcBuffer(4)), 0x3)*256 +512
        j= Bit.AND(j , 1023)
        PbY.Progress =j*100/1023
        Input(1) = j * 64
      
        j = ConvertSignedByteToUnsigned(RxPlcBuffer(5))+32
        j= Bit.AND(j , 63)
        PbZ.Progress =j*100/63
        Input(2) = j * 1024
      
        j = ConvertSignedByteToUnsigned(RxPlcBuffer(6))
        j= Bit.AND(j , 127)
        PbR.Progress =j*100/127
        Input(3) = j * 512
      
        Select Case Bit.AND(RxPlcBuffer(7), 0x0F)
        Case 0
            Img1.Bitmap = (LoadBitmap(File.DirAssets, "90.jpg"))
            Input(4) = 7280
        Case 1
            Img1.Bitmap =(LoadBitmap(File.DirAssets, "45.jpg"))
            Input(4) = 14560
        Case 2
            Img1.Bitmap =(LoadBitmap(File.DirAssets, "0.jpg"))
            Input(4) = 21840
        Case 3
            Img1.Bitmap =(LoadBitmap(File.DirAssets, "315.jpg"))
            Input(4) = 29120
        Case 4
            Img1.Bitmap =(LoadBitmap(File.DirAssets, "270.jpg"))
            Input(4) = 36400
        Case 5
            Img1.Bitmap =(LoadBitmap(File.DirAssets, "225.jpg"))
            Input(4) = 43680
        Case 6
            Img1.Bitmap =(LoadBitmap(File.DirAssets, "180.jpg"))
            Input(4) = 50960
        Case 7
            Img1.Bitmap =(LoadBitmap(File.DirAssets, "135.jpg"))
            Input(4) = 65535
        Case Else
            Img1.Bitmap =(LoadBitmap(File.DirAssets, "c.jpg"))
            Input(4) = 0
        End Select  
      
        If Bit.AND(RxPlcBuffer(8), 0x1) > 0 Then
            Ck1.checked = True
            Input(5) = 0xFFFF
        Else
            Ck1.Checked = False
            Input(5) = 0
        End If
        If Bit.AND(RxPlcBuffer(8), 0x2) > 0 Then
            Ck2.Checked = True
            Input(6) = 0xFFFF
        Else
            Ck2.Checked = False
            Input(6) = 0
        End If
        If Bit.AND(RxPlcBuffer(8), 0x4) > 0 Then
            Ck3.Checked = True
            Input(7) = 0xFFFF
        Else
            Ck3.Checked = False
            Input(7) = 0
        End If
        If Bit.AND(RxPlcBuffer(8), 0x8) > 0 Then
            Ck4.Checked = True
            Input(8) = 0xFFFF
        Else
            Ck4.Checked = False
            Input(8) = 0
        End If
        If Bit.AND(RxPlcBuffer(8), 0x10) > 0 Then
            Ck5.Checked = True
            Input(9) = 0xFFFF
        Else
            Ck5.Checked = False
            Input(9) = 0
        End If
        If Bit.AND(RxPlcBuffer(8), 0x20) > 0 Then
            Ck6.Checked = True
            Input(10) = 0xFFFF
        Else
            Ck6.Checked = False
            Input(10) = 0
        End If
        If Bit.AND(RxPlcBuffer(8), 0x40) > 0 Then
            Ck7.Checked = True
            Input(11) = 0xFFFF
        Else
            Ck7.Checked = False
            Input(11) = 0
        End If
        If Bit.AND(RxPlcBuffer(8), 0x80) > 0 Then
            Ck8.Checked = True
            Input(12) = 0xFFFF
        Else
            Ck8.Checked = False
            Input(12) = 0
        End If
      

End Sub

Sub DecomLogitecDualAction
Dim j As Int
        j = ConvertSignedByteToUnsigned(RxPlcBuffer(0))
        PbX.Progress =j*100/255
      
        j = ConvertSignedByteToUnsigned(RxPlcBuffer(1))
        PbY.Progress =j*100/255
        j = ConvertSignedByteToUnsigned(RxPlcBuffer(2))
        PbZ.Progress =j*100/255
        j = ConvertSignedByteToUnsigned(RxPlcBuffer(3))
        PbR.Progress =j*100/255
      
        If Bit.AND(RxPlcBuffer(4), 0x10) > 0 Then Ck1.checked = True Else Ck1.Checked = False
        If Bit.AND(RxPlcBuffer(4), 0x20) > 0 Then Ck2.Checked = True Else Ck2.Checked = False
        If Bit.AND(RxPlcBuffer(4), 0x40) > 0 Then Ck3.Checked = True Else Ck3.Checked = False
        If Bit.AND(RxPlcBuffer(4), 0x80) > 0 Then Ck4.Checked = True Else Ck4.Checked = False
        If Bit.AND(RxPlcBuffer(5), 0x1) > 0 Then Ck5.Checked = True Else Ck5.Checked = False
        If Bit.AND(RxPlcBuffer(5), 0x2) > 0 Then Ck6.Checked = True Else Ck6.Checked = False
        If Bit.AND(RxPlcBuffer(5), 0x4) > 0 Then Ck7.Checked = True Else Ck7.Checked = False
        If Bit.AND(RxPlcBuffer(5), 0x8) > 0 Then Ck8.Checked = True Else Ck8.Checked = False
          Select Case Bit.AND(RxPlcBuffer(4), 0x0F)
                Case 0
                    Img1.Bitmap = (LoadBitmap(File.DirAssets, "90.jpg"))

                Case 1
                    Img1.Bitmap =(LoadBitmap(File.DirAssets, "45.jpg"))

                Case 2
                    Img1.Bitmap =(LoadBitmap(File.DirAssets, "0.jpg"))

                Case 3
                    Img1.Bitmap =(LoadBitmap(File.DirAssets, "315.jpg"))
                  
                Case 4
                    Img1.Bitmap =(LoadBitmap(File.DirAssets, "270.jpg"))

                Case 5
                    Img1.Bitmap =(LoadBitmap(File.DirAssets, "225.jpg"))
                  
                Case 6
                    Img1.Bitmap =(LoadBitmap(File.DirAssets, "180.jpg"))
                  
                Case 7
                    Img1.Bitmap =(LoadBitmap(File.DirAssets, "135.jpg"))
            
                Case Else
                    Img1.Bitmap =(LoadBitmap(File.DirAssets, "c.jpg"))
            End Select
End Sub
Sub PerformMixing
        Try                                    'process mixing & reverse
        For Each V As View In Activity
            If V Is Spinner Then
                Dim Sp As Spinner
                Sp = V
                If Sp.Tag <> "" Then
                    Channel(Sp.Tag) = Sp.SelectedIndex    'mixing
                End If
            End If
            If V Is CheckBox Then
                Dim Ck As CheckBox
                Ck = V
                If Ck.Tag <> "" Then
                    Reverse(Ck.Tag) = Ck.Checked        'reverse mode
                End If
            End If
        Next
        Catch
        End Try
      
        Try
        For Each V As View In Activity
            If V Is ProgressBar Then
                Dim Pb As ProgressBar
                Pb = V
                If Pb.Tag <> "" Then
                     If Channel(Pb.Tag) < 4 Then 'joystick axis
                        If Reverse(Pb.Tag) Then
                            Output(Pb.Tag) = (0x10000 - Input(Channel(Pb.Tag)))  
                        Else
                            Output(Pb.Tag) = Input(Channel(Pb.Tag))
                        End If
   
                    End If
                    If Channel(Pb.Tag) = 4 Then 'hat
                        If Reverse(Pb.Tag) Then
                            Output(Pb.Tag) = (0x10000 - Input(Channel(Pb.Tag)))  
                        Else
                            Output(Pb.Tag) = Input(Channel(Pb.Tag))  
                        End If
                   
                    End If
                    If Channel(Pb.Tag) > 4 AND Channel(Pb.Tag) > 4 Then 'button
                        If Reverse(Pb.Tag) Then
                            Output(Pb.Tag) = (0x10000 - Input(Channel(Pb.Tag)))  
                        Else
                            Output(Pb.Tag) =  Input(Channel(Pb.Tag))
                        End If
                    End If
                    Pb.Progress = Output(Pb.Tag) *100/0x10000
                End If
            End If
        Next
        Catch
        End Try
End Sub
Sub OutputPPM

Dim NbWrite As Int
  If JPHIDstreams.IsInitialized Then

    For i = 0 To 7
        Output(i) = Output(i) * 3000 / 65535    'met à l'échelle pour le PIC 65535 => 1ms = 3000 ticks Timer0
        If (Output(i) > 65535) Then Output(i) = 65535
        If (Output(i) <0) Then Output(i) = 0
    Next

  
      TxPlcBuffer(0)= 0x80 '//0x80 est la commande d'envoi des paramètres au firmware

    TxPlcBuffer(1) = Floor(Output(0) / 256)
    TxPlcBuffer(2) = Output(0) - 256 * TxPlcBuffer(1)

    TxPlcBuffer(3) = Floor(Output(1) / 256)
    TxPlcBuffer(4) = Output(1) - 256 * TxPlcBuffer(3)

    TxPlcBuffer(5) = Floor(Output(2) / 256)
    TxPlcBuffer(6) = Output(2) - 256 * TxPlcBuffer(5)

    TxPlcBuffer(7) = Floor(Output(3) / 256)
    TxPlcBuffer(8) = Output(3) - 256 * TxPlcBuffer(7)

    TxPlcBuffer(9) = Floor(Output(4) / 256)
    TxPlcBuffer(10) = Output(4) - 256 * TxPlcBuffer(9)

    TxPlcBuffer(11) = Floor(Output(5) / 256)
    TxPlcBuffer(12) = Output(5) - 256 * TxPlcBuffer(11)

    TxPlcBuffer(13) = Floor(Output(6) / 256)
    TxPlcBuffer(14) = Output(6) - 256 * TxPlcBuffer(13)

    TxPlcBuffer(15) = Floor(Output(7) / 256)
    TxPlcBuffer(16) = Output(7) - 256 * TxPlcBuffer(15)
      
    NbWrite = JPHIDstreams.BulkTransfer(JPoutEndpoint,TxPlcBuffer,JPoutEndpoint.MaxPacketSize,500)
    'If NbWrite = -1 Then JPConnected = False
   
  End If

End Sub
Sub ConvertSignedByteToUnsigned(b As Byte) As Int
   Return Bit.AND(b, 0xFF)
End Sub
Sub ConnectJP
    Dim usbdevices() As UsbDevice
  usbdevices = manager.GetDevices

  'Iterate over devices and find the correct one
  For i = 0 To usbdevices.Length - 1

      Dim ud As UsbDevice
      ud = usbdevices(i)
      Log(ud)
      Log(ud.InterfaceCount)
      'Iterate over interfaces
      For a = 0 To ud.InterfaceCount - 1
        Dim inter As UsbInterface
        inter = ud.GetInterface(a) 
     
        If ud.VendorId = VID AND ud.ProductId = PID Then
            'found our device and interface
            JPdevice = ud
            JPinterface = inter
           
            'Find correct endpoints
            For b = 0 To JPinterface.EndpointCount - 1
              Dim endpoint As UsbEndpoint
             Log (JPinterface.EndpointCount)
              endpoint = JPinterface.GetEndpoint(b)
              ' And claim it
              If endpoint.Type = manager.USB_ENDPOINT_XFER_INT Then
                  If endpoint.Direction = manager.USB_DIR_IN Then
                    JPinEndpoint = endpoint
                    Log(JPinEndpoint.MaxPacketSize)
                  Else If endpoint.Direction = manager.USB_DIR_OUT Then
                    JPoutEndpoint = endpoint
                    Log(JPoutEndpoint.MaxPacketSize)
                  End If
              End If
            Next
        End If
      Next
    Next
 
    Try
    manager.RequestPermission(JPdevice)
    If manager.HasPermission(JPdevice) Then
       
        JPHIDstreams = manager.OpenDevice(JPdevice, JPinterface, True)
        Log("Connected")
        JPConnected = True
        Bt1.Enabled = True
    End If
    Catch
        JPConnected = False
        Bt1.Enabled = False
    End Try
End Sub
Sub ConnectJoystick
  Dim usbdevices() As UsbDevice
  usbdevices = manager.GetDevices

  'Iterate over devices and find the correct one
  For i = 0 To usbdevices.Length - 1

      Dim ud As UsbDevice
      ud = usbdevices(i)
      Log(ud)
      Log(ud.InterfaceCount)
      'Iterate over interfaces
      For a = 0 To ud.InterfaceCount - 1
        Dim inter As UsbInterface
        inter = ud.GetInterface(a)

        If inter.InterfaceClass = 3 AND inter.InterfaceSubclass = 0 AND ud.VendorId <> VID AND ud.ProductId <> PID Then 'HID interface
        'found our device and interface
            device = ud
            interface = inter
            JoyVID = ud.VendorId
            JoyPID = ud.ProductId
          
            'Find correct endpoints
            For b = 0 To interface.EndpointCount - 1
              Dim endpoint As UsbEndpoint
             Log (interface.EndpointCount)
              endpoint = interface.GetEndpoint(b)
              ' And claim it
              If endpoint.Type = manager.USB_ENDPOINT_XFER_INT Then
                  If endpoint.Direction = manager.USB_DIR_IN Then
                    inEndpoint = endpoint
                    Log(inEndpoint.MaxPacketSize)
                  Else If endpoint.Direction = manager.USB_DIR_OUT Then
                    outEndpoint = endpoint
                    Log(outEndpoint.MaxPacketSize)
                  End If
              End If
            Next
        End If
      Next
    Next
    Try
    manager.RequestPermission(device)
    If manager.HasPermission(device) Then  
      
        HIDstreams = manager.OpenDevice(device, interface, True)
        JoystickConnected = True
        Log("Connected")      
    End If
    Catch
        JoystickConnected = False
    End Try
End Sub
 

Jipy

New Member
Licensed User
Longtime User
Many, many Thanks,

This will be a Great help, i have already downloaded & installed the USBlizer software, so i can begin to take a look at your code; i will keep u aware about my findings with the Extreme 3D pro joystick.

Thanks again

Jipy
 
Top