Board index FlightGear Support Hardware

Saitek Switchpanel and hidraw devices

Joysticks, pedals, monitors.

Saitek Switchpanel and hidraw devices

Postby CptDondo on Mon Feb 20, 2012 10:56 pm

I've been playing around with the Saitek Switchpanel. It's not supported out of the box, but it is an hidraw device.
Code: Select all
Bus 002 Device 033: ID 06a3:0d67 Saitek PLC
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x06a3 Saitek PLC
  idProduct          0x0d67
  bcdDevice            1.10
  iManufacturer           1 HOLTEK
  iProduct                2 Saitek Pro Flight Switch Panel
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower               36mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.00
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      52
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0006  1x 6 bytes
        bInterval              10
Device Status:     0x0000
  (Bus Powered)


A bit of googling found this: http://members.aon.at/mfranz/warthog.html and this:
http://www.flightgear.org/forums/viewtopic.php?f=24&t=9402 which together would indicate that it's possible to get it working... However, I've run into a wall beyond that. Anyone know any more about getting an hidraw device working with flightgear?
 
Posts: 15
Joined: Sun May 17, 2009 6:28 pm

Re: Saitek Switchpanel and hidraw devices

Postby CptDondo on Tue Feb 21, 2012 2:11 am

I figured out how to get a report.... Anyone know how I can get useful data out of it?

Code: Select all
          bDescriptorType        34 Report
          wDescriptorLength      52
          Report Descriptor: (length is 52)
            Item(Global): Usage Page, data= [ 0x01 ] 1
                            Generic Desktop Controls
            Item(Local ): Usage, data= [ 0x00 ] 0
                            Undefined
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Global): Usage Page, data= [ 0x09 ] 9
                            Buttons
            Item(Local ): Usage Minimum, data= [ 0x01 ] 1
                            Button 1 (Primary)
            Item(Local ): Usage Maximum, data= [ 0x14 ] 20
                            (null)
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0x01 ] 1
            Item(Global): Report Size, data= [ 0x01 ] 1
            Item(Global): Report Count, data= [ 0x14 ] 20
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report Size, data= [ 0x01 ] 1
            Item(Global): Report Count, data= [ 0x04 ] 4
            Item(Main  ): Input, data= [ 0x01 ] 1
                            Constant Array Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Usage Page, data= [ 0x00 0xff ] 65280
                            (null)
            Item(Local ): Usage Minimum, data= [ 0x01 ] 1
                            (null)
            Item(Local ): Usage Maximum, data= [ 0x06 ] 6
                            (null)
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0x01 ] 1
            Item(Global): Report Size, data= [ 0x01 ] 1
            Item(Global): Report Count, data= [ 0x06 ] 6
            Item(Main  ): Feature, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report Size, data= [ 0x02 ] 2
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Main  ): Feature, data= [ 0x01 ] 1
                            Constant Array Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
 
Posts: 15
Joined: Sun May 17, 2009 6:28 pm

Re: Saitek Switchpanel and hidraw devices

Postby sgofferj on Tue Feb 21, 2012 5:44 am

Check the XPlane plugin for the Saitek panels. It's not really black magic. Originally, I wanted to look into it, but after Saitek was so bitchy about the SDK, I decided to drop it.
FG OSBS / SuSE 12.1 / Phenom II X4 / GForce GTX560
Stefan's little Flightgear corner | The Finnish Weather Center

Working on: EFTP
COM: IAX2:k-tanco.louhen-sudet.fi/stefan (MO-FR 0700-2000 UTC, SA+SU 0900-2000 UTC)
 
Posts: 712
Joined: Mon Dec 05, 2011 4:13 pm
Location: EFTP
Callsign: OH-SW
Version: OSBS
OS: Opensuse

Re: Saitek Switchpanel and hidraw devices

Postby CptDondo on Thu Feb 23, 2012 3:32 am

Got it!

You need to open the hidraw device. You could get fancy with O_NONBLOCK and select() if you want.

Code: Select all
fd = open ("/dev/saitek/switchpanel", O_RDWR);


Read 3 bytes; those are bit-mapped to the state of the switches. The device blocks until a switch changes state. I have not deciphered the bitmap for the magneto/start knob. Setting the LEDs does not change the state of this bitmap. :(

Code: Select all
read (fd, buf, 3);
state = buf[0] + (buf[1] << 8) + (buf[2] << 16);

You write two bytes to set the LEDs. First byte is 0x0, second byte is bit-mapped for the state of the LEDs. Each LED can be red or green. The LEDs are turned on as follows: 0x01 - top green, 0x02 - left green, 0x04 - right green, 0x08 - top red, 0x10 - left red, 0x20 - right red. I have not found a way to read the state of the LEDs, so you have to keep the state somewhere.

Code: Select all
              buf[0] = 0x0;
              buf[1] = 0xNN;
              write(fd, buf, 2);


So... Now how do I use this with Flightgear?
Last edited by CptDondo on Thu Feb 23, 2012 3:56 pm, edited 1 time in total.
 
Posts: 15
Joined: Sun May 17, 2009 6:28 pm

Re: Saitek Switchpanel and hidraw devices

Postby jcuk on Wed Jun 13, 2012 1:09 pm

After a lot of searching around I've come to the conclusion that the Saitek Pro switch panel my #2 son bought from ebay wasnt going to work with filghtgear, so I've decided to get stuck in and do something about it.

I found this thread a while ago and started to take a look a the XPlane plugin which I agree has all the info that should be needed. Development is going well despite my very rusty C/C++ (I'm a Java dev by trade) and I've managed to get a 'SPDemo' program working similar to JSDemo. I can operate all the switches, magneto dial and landing gear and decode all the messages correctly and I've even managed to get the red and green landing gear lights working.

I've got this working in XCode on my mac at the moment, so need to get a multi platform make file sorted so I can run it on my main linux box. I'm being hampered by on internet access at home which is slowing me down somewhat.

I think the next step after that is to make a new subsystem to handle the comms to the switch panel, then possibly a mapping file for each plane (I'm not sure about this - perhaps it could be written to be generic enough to just work but I'll cross this bridge when I come to it).

After this I'll have a crack at the multi panel and radio panels if #2 son saves up for them :D
 
Posts: 22
Joined: Sat Jun 02, 2012 8:35 pm
Location: Herts, UK
OS: OSX / Linux

Re: Saitek Switchpanel and hidraw devices

Postby burntpuppy on Sun Apr 21, 2013 6:42 pm

Have you made any progress on the Saitek panels? I'm interested in helping if you need the help. I have the switch abd radio panels.
Pat
 
Posts: 1
Joined: Sun Apr 21, 2013 6:39 pm

Re: Saitek Switchpanel and hidraw devices

Postby stuart on Tue Apr 23, 2013 2:50 pm

Hi Pat,

You might want to query the -devel list. I recall that Saitek met up with some of the other -devels at a flightsim conference and were interested in doing some interop.

-Stuart
G-MWLX
User avatar
Moderator
 
Posts: 987
Joined: Wed Nov 29, 2006 9:56 am
Location: Edinburgh
Callsign: G-MWLX