pfSense Support Subscription

Author Topic: [As Good As Solved!] Watchguard Firebox Arm/Disarm LED  (Read 37617 times)

0 Members and 1 Guest are viewing this topic.

Offline stephenw10

  • Hero Member
  • *****
  • Posts: 8084
    • View Profile
Re: Watchguard Firebox Arm/Disarm LED
« Reply #15 on: January 28, 2011, 07:04:45 pm »
Well I've spent far too many hours battling the led and so far it's winning!  ::)

I have fully explored the Winbond chip. It should be supported by the lm(4) driver but although a lot of work has been done it doesn't seem to have made it over to FreeBSD yet.
Using some really horrible programming skills and a lot copy and paste along with many cups of coffee I wrote a few programs to test the chip. No luck with the arm/disarm led I'm afraid. I was sure that would be it. I did manage to control all the internal testings LEDs in the Xe as well as adjusting the fan speed via pwm. Much quieter.  :) Also it opens the possibility of automatic fan control. Perhaps I missed something.
The arm/disarm led comes on at exactly the same moment the bios switches the fan PWM. I seems like it should be on the Winbond chip. Hmmmm.
« Last Edit: August 27, 2011, 07:35:23 pm by stephenw10 »

Offline iFloris

  • Full Member
  • ***
  • Posts: 168
  • one layer of information removed
    • View Profile
    • Small personal site
Re: Watchguard Firebox Arm/Disarm LED
« Reply #16 on: January 29, 2011, 05:03:27 am »
Hmmmm.

This is pretty neat stuff that you are exploring!
one layer of information
removed

Offline stephenw10

  • Hero Member
  • *****
  • Posts: 8084
    • View Profile
Re: Watchguard Firebox Arm/Disarm LED
« Reply #17 on: January 29, 2011, 09:59:05 am »
It's keeping me entertained and frustrated in equal measures!  ::)
It's definately not the PowerLED and SuspendLED outputs on the Winbond chip as these aren't connected to anything.

Offline stephenw10

  • Hero Member
  • *****
  • Posts: 8084
    • View Profile
Re: Watchguard Firebox Arm/Disarm LED
« Reply #18 on: February 01, 2011, 04:53:37 pm »
Haha! Victory is mine!  ;D
After way too much time trying this has been quite an education but...


Very long story short. On the X-Core-E box (an X750E) that I'm using for testing the arm/disarm led is driven by a pair of gpio pins on the ICH6 Southbridge chip. Specifically:
GPIO27 = Red/Disarmed LED
GPIO28 = Green/Armed LED
The led itself is a bi-colour led (obviously) but it is the two pin type so no orange is possible.  :(
The leds can be flashed by setting the appropriate 'blink' register in the ich6.

It seemed incredibly hard to pin down all the information to get this working and even now I'm pretty sure I was lucky.
I'm not yet sure if any of this applies to other Fireboxes but it will be fine on all the Xe type as they all have the same hardware.
The GPIO pins are accessed by writing to the appropriate IO space. That is defined as GPIObase address + offset to gpio level register. I'm not sure how you're supposed to be able to find the base address so I guessed based on other documentation. It seems to be usually at 0x480and it is in the firebox.
The bios sets up the correct registers to enable the GPIO pins and set them as outputs so all you have to do is change the values:
GP27 equates to 0x48f, bit3
GP28 equates to 0x48f, bit4
You need to set one or other to 1 as if both are high the led has +v on both ends.
I wrote a little program, mostly by copy and pasting, here.
I don't seem to have done any damage to my box setting any of the bits at 0x48f so I think it's fairly safe however the original value was 0x0B so in order to change the LED to green:
Code: [Select]
[2.0-BETA5][root@pfSense.localdomain]/root(50): ./writeio 0x48f 0x13
Setting 48f to 13
And back to red:
Code: [Select]
[2.0-BETA5][root@pfSense.localdomain]/root(49): ./writeio 0x48f 0x0b
Setting 48f to b
And to make it green flash:
Code: [Select]
[2.0-BETA5][root@pfSense.localdomain]/root(51): ./writeio 0x49b 0x10
Setting 49b to 10
Anf to make red flash:
Code: [Select]
[2.0-BETA5][root@pfSense.localdomain]/root(54): ./writeio 0x49b 0x08
Setting 49b to 8
To stop flashing:
Code: [Select]
[2.0-BETA5][root@pfSense.localdomain]/root(53): ./writeio 0x49b 0x00
Setting 49b to 0
Note that if you set either red or green to flash then it will appear that both red and green are flashing as the steady signal will be flashed by a switching one at the other end of the led.
The original Watchguard firmware has two flashing speeds but I've not found anyway to do that at a hardware level.
The program has no error checking or sanity checking so it's likely you could cause all kinds of damage by entering random figures!  :P
Let me know if this works for you.

Steve

Edit: I've not found how the expansion led is controlled yet, possibly some other means all together.

Edit2: Perhaps only partial victory is mine.  ::) The southbridge in the X-peak hardware is ICH5 which has the same set of GPIOs in the same memory location however they do not control the arm/disarm led on that box. I'm forced to conclude that all the boxes are different and will require more study.  :(


« Last Edit: February 01, 2011, 06:37:44 pm by stephenw10 »

Offline jdetmold

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
Re: [Partially Solved!] Watchguard Firebox Arm/Disarm LED
« Reply #19 on: February 03, 2011, 12:12:00 pm »
wow you've made a huge step! very awesome!

Offline iFloris

  • Full Member
  • ***
  • Posts: 168
  • one layer of information removed
    • View Profile
    • Small personal site
Re: [Partially Solved!] Watchguard Firebox Arm/Disarm LED
« Reply #20 on: February 04, 2011, 04:18:07 am »
Very interesting indeed, I'm going to give this a shot this weekend.
one layer of information
removed

Offline stephenw10

  • Hero Member
  • *****
  • Posts: 8084
    • View Profile
Re: [Partially Solved!] Watchguard Firebox Arm/Disarm LED
« Reply #21 on: February 04, 2011, 05:49:27 am »
Having tried this on my X6000 (X-peak) box it definitely doesn't work. Having said that it didn't do any harm either so if you want to try it on any of the Fireboxes I think it's safe enough.
I think this information is only relevant to the Xe (X550e, X750e etc) boxes.
You'd have thought that Watchguard would have wanted a consistent interface across their models but that doesn't appear to be the case.

Steve

Offline stephenw10

  • Hero Member
  • *****
  • Posts: 8084
    • View Profile
Re: [Partially Solved!] Watchguard Firebox Arm/Disarm LED
« Reply #22 on: February 04, 2011, 04:11:29 pm »
I have a much nicer newer program here.
This does fan speed query and setting as well as led changing.
Code: [Select]
[2.0-BETA5][root@pfSense.localdomain]/var/tmp(54): ./WGXe
WGXe can accept two arguments:
 -f (fan) will return the current fan speed or if followed
    by a number in hex, 00-FF, will set it.
 -l (led) will set the arm/disarm to the second argument:
    red, green, red_flash, green_flash, off
Again this is, currently, only relevant to the Xe Firebox.

Steve

Offline jimp

  • Administrator
  • Hero Member
  • *****
  • Posts: 14932
    • View Profile
Re: [Partially Solved!] Watchguard Firebox Arm/Disarm LED
« Reply #23 on: February 07, 2011, 11:15:38 am »
That's still very promising.

You could write a little GUI for it (feel free to look at/steal the code from the blinkled files in the packages repo) and we could put up a package for controlling the LED there. Having it work for one model is better than for none. If nothing else you could just have a setting for which color to make the LED at bootup, and then when the package sync's it could set the LED color.

You could even make a little dashboard widget (they're super simple to write) that shows the fan speed.
Need help fast? Commercial Support!

Co-Author of pfSense: The Definitive Guide. - Check the Doc Wiki for FAQs.

Do not PM for help!

Offline stephenw10

  • Hero Member
  • *****
  • Posts: 8084
    • View Profile
Re: [Partially Solved!] Watchguard Firebox Arm/Disarm LED
« Reply #24 on: February 07, 2011, 11:37:11 am »
Thanks for that. It makes me smile every time seeing that LED turn green.  ;D

At the moment I have a bash script in /usr/local/etc/rc.d that sets the fan speed changes the led colour.
Unfortunately the speed returned by the -f switch is only the current setting not the actual speed so I think a dashboard widget might be a bit boring! This is due to the fans only being three wire causing the PWM speed control to confuse the speed sensor output.

The Firebox LCD 'package' hasn't made it into a real package yet. Perhaps we could create a single package for Firebox users? I'm not sure how Watchguard might feel about that though?  ::)

Steve

Offline jimp

  • Administrator
  • Hero Member
  • *****
  • Posts: 14932
    • View Profile
Re: [Partially Solved!] Watchguard Firebox Arm/Disarm LED
« Reply #25 on: February 07, 2011, 12:15:01 pm »
Yeah there could be a package, either for that model specifically or for them in general. Though a more general package may be a little tougher to get right if you have to pick and choose the model as well as the features supported by that model.

...and as far as what watchguard thinks, it's a community-contributed package. Though even if it wasn't, there probably isn't much they can do. You could just rename it if they whine about the use of their name. It could just be a SmatchBlard BireFox package ;-)
Need help fast? Commercial Support!

Co-Author of pfSense: The Definitive Guide. - Check the Doc Wiki for FAQs.

Do not PM for help!

Offline iFloris

  • Full Member
  • ***
  • Posts: 168
  • one layer of information removed
    • View Profile
    • Small personal site
Re: [Partially Solved!] Watchguard Firebox Arm/Disarm LED
« Reply #26 on: February 07, 2011, 12:17:41 pm »
This is great, hope both the firebox (x core) lcd and this new (Xe) LED / fanspeed make it into packages.
Once again, neat work stephenw10!
« Last Edit: February 07, 2011, 12:23:56 pm by iFloris »
one layer of information
removed

Offline stephenw10

  • Hero Member
  • *****
  • Posts: 8084
    • View Profile
Re: [Partially Solved!] Watchguard Firebox Arm/Disarm LED
« Reply #27 on: February 09, 2011, 08:24:15 am »
Some more progress.  :)
I have found the control for the arm/disarm led on the X-Peak box. It's connected to the gpios on the ICH5 southbridge chip, like the Xe, however on the 6300ESB in the x-peak it's controlled by gpio40 (red) and gpio41 (green). The 6300ESB has four special gpios capable of driving leds directly (40-43) which is why I think they are using these instead of the same as the Xe. Anyway these are controlled by the 0x4B9 register on bits 0 and 1. E.g. for red:
Code: [Select]
[2.0-BETA4][root@pfSense.localdomain]/var/tmp(62): ./writeio 0x4b9 0d
Setting 4b9 to d
And for green:
Code: [Select]
[2.0-BETA4][root@pfSense.localdomain]/var/tmp(63): ./writeio 0x4b9 0e
Setting 4b9 to e

Unfortunately there is no 'built in' flashing capability for these gpios.  :(
I think watchguard had software flashing as they had fast and slow ability as well.

This new result leads me to believe that the X-core is almost certainly on a southbridge gpio also but I don't have an X-core to hand to test (yet!).

Steve

Edit: Here is a newer version of the program that can control both the Xe and X-Peak boxes.
« Last Edit: February 09, 2011, 05:09:03 pm by stephenw10 »

Offline iFloris

  • Full Member
  • ***
  • Posts: 168
  • one layer of information removed
    • View Profile
    • Small personal site
Re: [More Solved!] Watchguard Firebox Arm/Disarm LED
« Reply #28 on: February 09, 2011, 09:52:52 am »
Stephenw10, I have two fireboxes that once were a x700 and an x500, only one of which is in 'production' at any given moment.
Is there something I can help test for you?
one layer of information
removed

Offline stephenw10

  • Hero Member
  • *****
  • Posts: 8084
    • View Profile
Re: [More Solved!] Watchguard Firebox Arm/Disarm LED
« Reply #29 on: February 09, 2011, 10:24:47 am »
Yep. It's a pretty simple test procedure.
I'm not sure what the southbridge is in the X-core. I had in my mind that it's the ICH0 but now I can't find where I might have read that. Anyway first check your bootup dmesg for the chip. I'm pretty sure it's a 82801ab in which case get the data sheet here. Now the idea is to probe the register addresses and check the result against the defaults listed on the data sheet. Look for what has been changed. On that data sheet the section you are looking for is 8.10.1 GPIO Register I/O Address Map.
Download the two programs I wrote,readio and writeio, from here.
Copy them to your box and change the permissions to 0755 so you can run them.
Then read the address with readio followed by a hex value.
The base address of the gpio is almost certainly 0x480 (but might not be!) so to read the first register:
Code: [Select]
[2.0-BETA5][root@pfSense.localdomain]/root(22): ./readio 0x480
Reading 480 :81
Except it won't be 81 on your box.
You need to read;
0x480-0x483. GPIO use select
0x484-0x487. GPIO input or output select
0x48c-0x48f. Actual GPIO values.
The numbers you'll get come out in reverse order, 0x480 is the least significant byte of that register.
Although you start out with 32 possible gpios you'll see that only a few are contenders. They need to be set as gpio in use select (1) and set as outout in I/O select (0).
Then use writeio (register, value) to change the numbers and see if the led goes out.
Write everything down!

Steve

Edit: And if none of that works there's a second set of registers as I found out for the X-peak.
« Last Edit: February 09, 2011, 10:29:27 am by stephenw10 »