Board index FlightGear Support Hardware

Saitek Switchpanel and hidraw devices

Joysticks, pedals, monitors.

Saitek Switchpanel and hidraw devices

Postby CptDondo » 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?
CptDondo
 
Posts: 16
Joined: Sun May 17, 2009 6:28 pm

Re: Saitek Switchpanel and hidraw devices

Postby CptDondo » 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
CptDondo
 
Posts: 16
Joined: Sun May 17, 2009 6:28 pm

Re: Saitek Switchpanel and hidraw devices

Postby sgofferj » 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 3.1 GIT / Opensuse 12.3 / Phenom II X4 / GForce GTX560
Stefan's little Flightgear corner | The Finnish Weather Center | Wolves in Finland

Working on: EFTP
COM: IAX2:home.gofferje.net/stefan (MO-FR 0700-2000 UTC, SA+SU 0900-2000 UTC)
sgofferj
 
Posts: 790
Joined: Mon Dec 05, 2011 4:13 pm
Location: EFTP
Callsign: OH-SW
Version: 3.1 GIT
OS: Opensuse

Re: Saitek Switchpanel and hidraw devices

Postby CptDondo » 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.
CptDondo
 
Posts: 16
Joined: Sun May 17, 2009 6:28 pm

Re: Saitek Switchpanel and hidraw devices

Postby jcuk » 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
jcuk
 
Posts: 22
Joined: Sat Jun 02, 2012 8:35 pm
Location: Herts, UK
OS: OSX / Linux

Re: Saitek Switchpanel and hidraw devices

Postby burntpuppy » 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
burntpuppy
 
Posts: 1
Joined: Sun Apr 21, 2013 6:39 pm

Re: Saitek Switchpanel and hidraw devices

Postby stuart » 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
stuart
Moderator
 
Posts: 1053
Joined: Wed Nov 29, 2006 9:56 am
Location: Edinburgh
Callsign: G-MWLX

Re: Saitek Switchpanel and hidraw devices

Postby Keith_Beef » Sat Nov 30, 2013 3:00 pm

Has there been any more news about progress on this?

I don't understand why Saitek has made this more complicated than it needed to be.

I have the Saitek yoke and quadrant (as well as a CHP yoke, quadrant and pedal set) and would have expected the switch panels to plug into the yoke hub and just show up as extra switches and axes, in addition to those on the yoke and quadrant.

I'm considering buying a set of Saitek pedals and a switch panel, or alternatively making my own panel. I bought a load of components a few years ago and started building a helicopter joystick… but my full-time job, when I landed it, tended to monopolise my time.

Also, I have a Thrustmaster HOTAS X that I just got out of its box, bought two or three years ago and never used… This didn't work straight off, but I've read that the Warthog HOTAS works… another perplexing situation, where one Thrustmaster device works out-of-the-box, yet another doesn't.

One last (I hope) addition to this post: has anybody seen the Saitek Cessna Trim Wheel working? I stumbled across it when looking for panel bezels, on sale at a few RC and flight sim retailers for around £45.
Keith_Beef
 
Posts: 72
Joined: Thu Sep 03, 2009 3:12 am
Version: 2.4.0
OS: Ubuntu 12.04 LTS

Re: Saitek Switchpanel and hidraw devices

Postby Keith_Beef » Wed Dec 04, 2013 12:55 pm

Picked up a switch panel this morning, plugged it in and it shows up as a HIDRAW device.

Code: Select all
Dec  4 13:04:12 saturn kernel: [72593.468263] usb 1-2.3: new low-speed USB device number 24 using ehci_hcd
Dec  4 13:04:12 saturn mtp-probe: checking bus 1, device 24: "/sys/devices/pci0000:00/0000:00:1a.7/usb1/1-2/1-2.3"
Dec  4 13:04:12 saturn mtp-probe: bus: 1, device: 24 was not an MTP device
Dec  4 13:04:12 saturn kernel: [72593.585815] input: HOLTEK Saitek Pro Flight Switch Panel as /devices/pci0000:00/0000:00:1a.7/usb1/1-2/1
-2.3/1-2.3:1.0/input/input12
Dec  4 13:04:12 saturn kernel: [72593.585919] generic-usb 0003:06A3:0D67.0003: input,hidraw2: USB HID v1.00 Device [HOLTEK Saitek Pro Fli
ght Switch Panel] on usb-0000:00:1a.7-2.3/input0


Code: Select all
ls -al /dev/input/by-id/
total 0
drwxr-xr-x 2 root root 120 Dec  4 13:04 .
drwxr-xr-x 4 root root 380 Dec  4 13:04 ..
lrwxrwxrwx 1 root root  10 Dec  4 13:04 usb-HOLTEK_Saitek_Pro_Flight_Switch_Panel-event-if00 -> ../event12
lrwxrwxrwx 1 root root   9 Dec  3 16:54 usb-Logitech_USB_Receiver-event-kbd -> ../event2
lrwxrwxrwx 1 root root   9 Dec  3 16:54 usb-Logitech_USB_Receiver-if01-event-mouse -> ../event3
lrwxrwxrwx 1 root root   9 Dec  3 16:54 usb-Logitech_USB_Receiver-if01-mouse -> ../mouse0


A bit of testing with evtest shows changing states when I flick some switches.

Code: Select all
sudo evtest /dev/input/event12

Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x6a3 product 0xd67 version 0x100
Input device name: "HOLTEK Saitek Pro Flight Switch Panel"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 256 (BTN_0)
    Event code 257 (BTN_1)
    Event code 258 (BTN_2)
    Event code 259 (BTN_3)
    Event code 260 (BTN_4)
    Event code 261 (BTN_5)
    Event code 262 (BTN_6)
    Event code 263 (BTN_7)
    Event code 264 (BTN_8)
    Event code 265 (BTN_9)
    Event code 266 (?)
    Event code 267 (?)
    Event code 268 (?)
    Event code 269 (?)
    Event code 270 (?)
    Event code 271 (?)
    Event code 272 (BTN_LEFT)
    Event code 273 (BTN_RIGHT)
    Event code 274 (BTN_MIDDLE)
    Event code 275 (BTN_SIDE)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Testing ... (interrupt to exit)


Now if I turn the "engine selector" rotary switch, I see events.

From "OFF" to "R":
Code: Select all
Event: time 1386161077.042743, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9000e
Event: time 1386161077.042744, type 1 (EV_KEY), code 269 (?), value 0
Event: time 1386161077.042745, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9000f
Event: time 1386161077.042746, type 1 (EV_KEY), code 270 (?), value 1
Event: time 1386161077.042752, -------------- SYN_REPORT ------------


From "R" to "L":
Code: Select all
Event: time 1386161117.938760, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9000f
Event: time 1386161117.938762, type 1 (EV_KEY), code 270 (?), value 0
Event: time 1386161117.938763, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90010
Event: time 1386161117.938764, type 1 (EV_KEY), code 271 (?), value 1
Event: time 1386161117.938769, -------------- SYN_REPORT ------------


From "L" to "R":
Code: Select all
Event: time 1386161173.178777, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90010
Event: time 1386161173.178778, type 1 (EV_KEY), code 271 (?), value 0
Event: time 1386161173.178783, -------------- SYN_REPORT ------------
Event: time 1386161173.202765, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9000f
Event: time 1386161173.202766, type 1 (EV_KEY), code 270 (?), value 1
Event: time 1386161173.202772, -------------- SYN_REPORT ------------


From "R" to "OFF":
Code: Select all
Event: time 1386161299.458811, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9000e
Event: time 1386161299.458812, type 1 (EV_KEY), code 269 (?), value 1
Event: time 1386161299.458813, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9000f
Event: time 1386161299.458814, type 1 (EV_KEY), code 270 (?), value 0
Event: time 1386161299.458820, -------------- SYN_REPORT ------------


Moving the landing gear lever from "UP" to "DOWN":
Code: Select all
Event: time 1386161373.602837, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90013
Event: time 1386161373.602838, type 1 (EV_KEY), code 274 (BTN_MIDDLE), value 0
Event: time 1386161373.602840, -------------- SYN_REPORT ------------
Event: time 1386161373.650830, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90014
Event: time 1386161373.650831, type 1 (EV_KEY), code 275 (BTN_SIDE), value 1
Event: time 1386161373.650832, -------------- SYN_REPORT ------------


Moving the landing gear lever from "DOWN" to "UP":
Code: Select all
Event: time 1386161406.738849, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90013
Event: time 1386161406.738850, type 1 (EV_KEY), code 274 (BTN_MIDDLE), value 1
Event: time 1386161406.738852, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90014
Event: time 1386161406.738852, type 1 (EV_KEY), code 275 (BTN_SIDE), value 0
Event: time 1386161406.738853, -------------- SYN_REPORT ------------


Switching the "AVIONICS MASTER" to "ON"
Code: Select all
Event: time 1386161519.898865, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
Event: time 1386161519.898865, type 1 (EV_KEY), code 258 (BTN_2), value 1
Event: time 1386161519.898878, -------------- SYN_REPORT ------------


I should be able to look for a state change on a single event, but haven't quite figured that out yet.

The syntax is
Code: Select all
evtest --query /dev/input/eventX <type> <value>

<type> is one of: EV_KEY, EV_SW, EV_LED, EV_SND
<value> can either be a numerical value, or the textual name of the
key/switch/LED/sound being queried (e.g. SW_DOCK).


I can look at the state of the "AVIONICS MASTER" switch, but get no returned value.
Code: Select all
sudo evtest --query /dev/input/event12 EV_KEY BTN_2


I expected to see a value returned like "1" for the "ON" position, or "0" for the "OFF" position, but I don't get anything.
Keith_Beef
 
Posts: 72
Joined: Thu Sep 03, 2009 3:12 am
Version: 2.4.0
OS: Ubuntu 12.04 LTS

Re: Saitek Switchpanel and hidraw devices

Postby Hooray » Wed Dec 04, 2013 1:14 pm

Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
Nasal | Projects | Core development |
Programming resources
Hooray
 
Posts: 6566
Joined: Tue Mar 25, 2008 8:40 am

Re: Saitek Switchpanel and hidraw devices

Postby stuart » Thu Dec 05, 2013 10:20 pm

Keith_Beef wrote in Sat Nov 30, 2013 3:00 pm:One last (I hope) addition to this post: has anybody seen the Saitek Cessna Trim Wheel working? I stumbled across it when looking for panel bezels, on sale at a few RC and flight sim retailers for around £45.


Yes, I've got one, and have it working. I think mine has a minor hardware fault, as under Linux it stops working after a little while and I have to use Debug->Reload Input. Otherwise its very good.

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

Re: Saitek Switchpanel and hidraw devices

Postby norax » Wed May 28, 2014 5:10 am

Did anyone ever get this (Saitek Pro Flight Switch Panel) working on OS X with FlightGear?
norax
 
Posts: 2
Joined: Wed May 28, 2014 5:09 am



Return to Hardware

Who is online

Users browsing this forum: No registered users and 2 guests