Firefox Xmarks

Paul (Nickname Killerx) did a great job with developing the GPO add-on for Firefox called GPOFirefox.
There are a couple of Extensions out there, that handle the interface between Firefox and the Registry. That’s in case all you need to do, if you add some of these admx files around for managing Firefox through GPO. Since Paul stopped the development of the Gpofirefox add-on with version 5 of Firefox there are some things, that this add-on can’t handle.

First of all, there are some differences between this add-on and other add-ons like for example the one of Frontmotion, which isn’t really a add-on. It’s kind of build into the so called Community Edition of Frontmotion Firefox. The Frontmotion add-on lacks at some point, when you need to change more settings than just the defaults like browser startup homepage, or proxy settings. If you only need these few defaults, I would recommend to use Frontmotions version, instead of any other, because Frontmotion comes with a customized admx file for all default settings in Firefox. The point, where this is not enough is when you want to change settings for example of an extension. Because Frontmotions admx file doesn’t support custom settings, so you can’t handle this.

Lets explain, how these GPO add-ons work.
Frontmotion offers an admx template that can be imported to your active directory gpo manager, to change all default settings. In the background, everything is done by writing some strings to the registry. Firefox reads these values and changes them locally in your running Firefox (about:config). That’s it. So, to test these add-ons, all you need to do is just open your registry editor and go to \HKLM|HKCU\software\policies\mozilla\defaultpref|pref|lockedpref (depending of kind of GPO add-on you are using). Here comes the gap.
Frontmotion doesn’t support any other values than the default settings of Firefox. Although this is really long list, but you are not able to control any setting that doesn’t belong to the default set of Firefox. Even if you set custom settings in your registry, they aren’t noticed! GPOFirefox does support these custom values, but lacks at some point as well. For example, if you want to use xmarks with your own server, you can set extesnions.xmarks.useOwnServer to true.
After putting it to the registry it looks like this:

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\SOFTWARE\Policies\Mozilla\defaultpref] "extensions.xmarks.useOwnServer"="true"

This setting only applies to your Firefox (about:config) if it already exists in your about:config list. Otherwise it is dropped and you can spend hours to check your settings until you notice, that it is not provided to set not existing values. Why is that? GPOFirefox reads all of your values without any limitation. After reading, the add-on tries to change these values in Firefox. Because Firefox has different types of variables, (string, integer, boolean) it first reads the variable type (in your about:config list), to set the correct variable type and its value. That means, if your add-on tries to set a value that doesn’t exist in Firefox already, it can’t determine the variable type and wont write your setting to Firefox. Pretty uncool.
After extracting Pauls add-on I extended it to the ability to write a setting to Firefox even if it doesn’t exists. This is done by checking, if the value exists (like before) and if it doesn’t exists, the add-on tries to detect, what type the value is. If your setting extensions.xmarks.useOwnServer doesn’t exist, my code extension checks the value (in this case the value is „true“) and writes a Boolean preference to Firefox.
I stumbled across another problem, which is a bug in the add-on. If you try to set a Boolean value that is „false“, e.g. to turn off the telemetry stuff in Firefox the add-on sets this value to true. I think this happens, because the used function to create bool settings in Firefox needs an bool parameter and not a string parameter like the add-on uses. Maybe the setter function checks if the committed parameter is Boolean by checking it like „if (parameter) { write true } else { write false}“.
In this case every string is interpreted as Boolean:true and leads to this wrong behavior!

Because I don’t want to hurt any copyrights and to respect Pauls great work I only publish some instructions on how to extend the add-on by yourself.

First of all you need three Things:
– 7 Zip
– Firefox (my Version is 24)
– The gpofirefox add-on (https://add-ons.mozilla.org/de/firefox/add-on/gpo-for-firefox/)
1. Use 7Zip to extract the XPI File
2. Go to the extracted folder and open the chrome folder
3. Use 7Zip to extract the gpofirefox.jar
4. Delete gpofirefox.jar
5. Modify the file gpofirefox.js in <extracted-extension-folder>\chrome\gpofirefox\content\ (difference between original and modified)
6. Mofify <extracted-extension-folder>\chrome.manifest ( difference between original and modified )
7. Go to <extracted-extension-folder> and Select „chrome“, „defaults“, „chrome.manifest“, „install.rdf“ and use 7.ZIP -> Add new archive (zip)
8. Rename the created zip file to gpofirefox@extensions.org.xpi
9. Install your add-on (or copy it to extensions folder) Renaming and modifying the internal add-on structure is to simplify the add-on for further changes

Please leave me a comment. I’m actually thinking about creating an add-on like this with some further functionality like adding the ability to write to sqllite databases (popup blocking), replace / update files in the profile and so on. Everything controlled by the registry via group policy AD Things .
For testing purpose you can use a registry file like the below one.

Keep in mind, that these settings are only for the CURRENT_USER. If you want to set everything machine wide you have to rewrite the reg file to HKEY_LOCAL_MACHINE instead of HKEY_CURRENT_USER


Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Policies\Mozilla]
[HKEY_CURRENT_USER\Software\Policies\Mozilla\defaultpref]
"browser.startup.homepage"="intranet"
"browser.search.suggest.enabled"="false"
"browser.shell.checkDefaultBrowser"="true"
"browser.tabs.warnOnClose"="false"
"extensions.zotero.firstRun2"="false"
"signon.rememberSignons"="false"
"startup.homepage_override_url"="intranet"
"extensions.pendingOperations"="true"
"extensions.xmarks.username"="marco"
"extensions.xmarks.sync-tabs"="true"
"extensions.xmarks.syncOnShutdown"="1"
"add-on.disable_full_page_add-on_for_types"=""

[HKEY_CURRENT_USER\Software\Policies\Mozilla\lockPref]
"datareporting.healthreport.uploadEnabled"="false"
"toolkit.telemetry.enabled"="false"
"toolkit.telemetry.prompted"="2"
"toolkit.telemetry.rejected"="true"
"privacy.donottrackheader.enabled"="true"
"extensions.update.notifyUser"="false"
"browser.search.update"="false"
"browser.rights.3.shown"="true"
"extensions.blocklist.enabled"="false"
"extensions.autoDisableScopes"="0"
"extensions.zotero.firstRunGuidanceShown.saveIcon"="true"

If you want to add your settings to a GPO, open the Group Policy Management and edit your current / create a new GPO object. Now you have to choose if you want to create registry entries for user (user configuration) or computer (computer configuration). Afterwards choose [ Settings -> Windows Settings -> Registry ]. We decided to create two sub folders, one for locked pref and one for default pref, as shown here:

GPO Firefox Registry Settings

GPO Firefox Registry Settings

Next step: Create a new registry element at the right side. This could look like this:

GPO Firefox Registry Settings

GPO Firefox Registry Settings

How about an ADM/ADMX file?
– If you want to use an ADMX file you have to create it from scratch.
– There are so many settings available in Firefox itself that it would take too long to create it.
– It’s not flexible enough, because every add-on has its own settings.
– If you add another add-on / update Firefox you maybe have to extend your own ADMX file.

These are the reasons why I prefer adding everything „raw“ to the registry. For deactivating some Firefox features you have to Google once, or check the prefs.js file changes These bugs are fixed with version 0.9.3 –

Ikea Dioder Hack with IR

Ich bin letztens über eine nette Seite gestolpert (www.ikeahackers.net) auf der Leute ihre Ikea Hacks präsentieren und habe dort durch Zufall auch den Ikea Dioder entdeckt.
Der Ikea Dioder ist, wie der Name schon sagt ein LED Bauteil, das gerne als Raumbeleuchtung, bzw. Hintergrundbeleuchtung verwendet wird. Hierfür sind 4 LED Streifen im Paket enthalten die per Kabel an einen Verteiler angeschlossen werden. Dieser ist für den Strom zuständig. An diesen Verteiler ist auch die Steuereinheit zum bedienen angeschlossen.
Ich habe den Dioder selbst schon einige male bei Ikea gesehen, konnte mich aber nie durchringen einen zu kaufen. Der Stückpreis von 30€ ist auf Grund der Bauteile sicher durchaus berechtigt aber mich störte die Art, wie man den Dioder bedient. Jedes mal, wenn man die Farbe wechseln will muss man aufstehen und die Farbe von Hand einstellen und kann es sich danach wieder bequem machen. Das stört mich doch ziemlich. Es gibt aber auch durchaus Module die eine kleine Fernbedienung mit sich bringen, aber auch hier muss ich sagen, dass ich keine Lust darauf habe 5 Fernbedienungen auf dem Tisch liegen zu haben mit denen man seinen heimischen Elektrozoo fernsteuert. Darum habe ich mir schon vor Jahren eine Universalfernbedienung gekauft und alle Endgeräte auf eine Fernbedienung reduziert. Noch dazu kommt, dass man den Dioder nicht dimmen kann, was leider ein weiterer Minus Punkt ist.

Nach dem ich aber die eingangs erwähnte Seite besucht hatte und gesehen habe wie der Dioder intern aufgebaut ist kam mir die Idee einfach einen eigenen Microcontroller auf die Platine zu löten und ein zusätzliches Modul zu bauen, das es mir ermöglicht Signale von meiner Universalfernbedienung zu lesen und diese in entsprechende Signale umzuwandeln. Damit kann man die LED Leisten einfach und praktisch vom Sofa aus steuern. Da ich in der Vergangenheit schon Erfahrung mit RGB LEDs gesammelt hatte (siehe: Prolight RGB Led 3 Watt – Software PWM ) konnte ich den Code relativ simpel adaptieren und zusätzlich noch den Code für den IR Empfänger hinzufügen.

Folgende Dinge sind notwendig um den Umbau zu bewerkstelligen
– IKEA Dioder
– Lötkolben mit sehr dünner spitze
– Microcontroller von Atmel (Attiny44, da dieser von den Anschlusspins auch gut passt)
– Atmel Flasher (zum Flashen des Programms auf den Controller)
– Eine Ruhige Hand zum löten
– Seitenschneider (klein und spitz, z.B. von Knipex)
– Infrarot Modul

Hier ist ein Bild wie die Platine nach dem auseinander bauen der Steuereinheit aussieht.

Ikea Dioder Hardware with PIC Controller

Ikea Dioder Hardware with PIC Controller

Hier ging es nun darum den vorhandenen Microcontroller zu ersetzen. Da ich keinen Programmer für den bereits vorhandenen PIC Controller besitze musste dieser also weichen. Das entfernen ging relativ einfach, in dem ich die Beine des Microcontrollers oben am schwarzen Gehäuse ab geknipst habe (ein Bein nach dem anderen). Dann konnte man das, was vom Microcontroller übrig geblieben ist relativ einfach mit einer Pinzette entfernen. Im nächsten Schritt habe ich dann die Reste der übrig gebliebenen Beinchen einfach mit dem Lötkolben entfernt. Dann sah das ganze so aus und war bereit einen neuen Microcontroller zu bekommen.

 

Ikea Dioder Hardware without PIC Controller

Ikea Dioder Hardware without PIC Controller

Wie gesagt, der Attiny24/44/84 ist Pin kompatibel zum Pic und passt genau auf die freien Lötstellen. Somit spart man sich eine extra Platine und noch mehr Geraffel wie z.B. ein neues Gehäuse usw… Ich habe mich für den Atmel44 entschieden. Er hat 2 Timer mit PWM, läuft auf 8Mhz mit dem internen Taktgeber und hat 4kb Speicher. 4kb ist nicht die Welt, da aber mein fertig kompiliertes hex um die 3,5kb hat war das ausreichend. Im gleichen Zug habe ich noch diverse Bauteile entfernt, die ich nicht mehr benötige, wie z.B. den kleinen Poti, der vorher für die Farbänderung zuständig war, in dem er die Spannung an einem Anschlusspin des Pic Microcontrollers verändert hat. Mit aufgelötetem Attiny44 sieht das ganze dann so aus:

Ikea Dioder Board wired to my flasher

Ikea Dioder Board wired to my flasher

Ikea Dioder Board with Attiny45 - zoom

Ikea Dioder Board with Attiny45 - zoom

Hier noch der Infrarot Sensor, den ich mit einer handelsüblichen IR Diode (TSOP1736) gebaut habe

IRDA for Ikea Dioder

IRDA for Ikea Dioder

Nach dem alle Bauteile verdrahtet waren konnte ich mich an das Programm machen. Hierfür habe ich im Vorfeld das Ikea Dioder Board mit einem Atmega8 verbunden, weil der Mega8 glücklicherweise über UART verfügt. Somit konnte ich auslesen ob die Elektronik funktioniert. Als UART lief habe ich die IRMP Bibliothek von Mikrokontroller.net heruntergeladen, die auch in der neusten Version mit dem Attiny84 (und somit auch Attiny44) funktioniert. Infrarot war dank der hervorragenden Bibliothek kein Problem und das bereits erwähnte PWM für die RGB Steuerung anzuflanschen ebenfalls nicht. Lediglich beim portieren vom Atmega8 auf den kleinen Attiny44 gab es etwas Probleme, da sich z.B. die Anzahl der Timer unterscheidet.

Wie erwähnt habe ich einen der Taster entfernt. Dort wird der IR Sensor angeschlossen (Bild 3, links oben). Dieser Anschluss führt zum PinB1 auf dem Attiny. Die restlichen Portpins liegen relativ günstig, so dass z.B. die RGB Ansteuerung auf die Pins PinA0, PinA1 und PinA2 gelegt sind. Den restlichen Pins benötige ich derzeit nicht, somit konnte ich auch (Bild 4) die Widerstände R1-R4 komplett entfernen. Nach dem alles getestet wurde kann alles wieder in das alte Gehäuse gebaut werden, das nun zwar ohne Funktion ist, aber seinen Zweck super erfüllt.

Ikea Dioder with wired IRDA

Ikea Dioder with wired IRDA

Nun muss die Infrarot Empfänger Platine nur noch etwas abgeschirmt werden und dann ist es bereit verbaut zu werden.

Die restlichen Bilder gibt es in der Galerie: