Tuesday, April 3, 2012

SSL

Still working on finishing iSCSI, lots of fun there... But on another note I now have a real signed certificate from a real authority! So cool.

Sunday, April 1, 2012

iSCSI

This will probably be my last post on blogger, going to transition this blog to my own hosted blog. However until I do I just want to give a brief on what I am doing now.

I wanted to set up a completely disk less boot. I want this for multiple reasons the biggest of which it is really freaking awesome. The other reason is to give an easy and always working recovery option - any computer could boot from this network image. As long as I keep all the drivers and not try to optimize the kernel I could boot pretty much any comptuer from the network and have it boot up my media center, or anything else. One goal is to go to a disk less very thin media center pc so I can get rid of the cool but always troublesome multiseating and start using the nvidia drivers and get much better graphics etc... There are plenty of other reasons but onto how to do it.

To boot into iscsi there are supposedly LAN cards that can do it nativly, supposedly mine can do it  however I didn't use the native boot (I think). To tell the truth I only think I know what is going on with this boot process however I am most likely completely wrong but it works...
I think I use gPXE to chainload a PXE boot into a iSCSI boot rom that boots from iSCSI.
gPXE wiki
the second link is pretty much all I used. I set up my ASUS RT-N16 router with Tomato firmware to host the gPXE file using tftp. I will try and make a entry on getting tftp working on most any router but for now read around, you will want to know a thing or two about network booting first...

Now that the boot worked I needed something to boot. I could of gone the easy route of using a usb drive, boot into the live arch installer, install open-iscsi there, log into the target install arch on the target and set up in the live environment. Truthfully I hate sitting at my main computer with laptop by my and not having my main computer so I went my own route. I followed these instructions for install arch from a running system.
https://wiki.archlinux.org/index.php/Install_from_Existing_Linux
Its actually quite easy from a running arch system. Start at Setup the Target System and you will be installed in a couple minutes. Next is grub, I always use grub2, don't ask me why but I always use grub2 (maybe because grub is always the one in the how to's and I like a challenge). This part was a little harder, follow the Arch Wiki pages for iscsi boot and grub2 - that will get you there.

I think my chroot install of lightdm is done so more coming later....

Monday, February 27, 2012

Razer Udev

Ldap is up and running but I had to go way off the wikis to get it working, how I got it working soon. But for now how I just made razer anasi udev events easily.

/lib/udev/keymap -i /dev/input/by-id/usb-Razer_Razer_Anansi-event-kbd >> macros

This was super easy to edit with some find and replaces, and here is the original. The rest is the same as the logitech touchpad.



0x7006A  f15 #M1
0x7006B  f16 #M2
0x7006C  f17 #M3
0x7006D  f18 #M4
0x7006E  f19 #M5
0x7006F  f20 #T1
0x70070  f21 #T2
0x70071  f22 #T3
0x70072  f23 #T4
0x70092  katakana #T5
0x70093  hiragana #T6
0x7008C  kpjpcomma #T7
0x70073  f24 #FN




Keycodes are in this file, /usr/include/linux/input.h remove the KEY_ and convert to lowercase. I included the fn key because it needs to remapped, once you do I beleive all the media keys work, I don't use them, I'm using xbindkeys with a guile configuration to allow for the left side macro keys to act as a switch to change many of the keys on my keyboard (control XBMC, control receiver, control TV)

Sunday, February 26, 2012

Openldap... ugh

I was putting this off but I'm tired of not having everything set up. Whenever I set up linux I set up a local admin account to get everything running. I then set up ldap for my actual user. This has probably been the most problematic part of resent life with linux and much of the reason I moved to Arch. In Ubuntu they try to auto set up everything, well that half works and getting the other half working is harder than hell because when I used Ubuntu I only had to edit configs for non standard packages. Arch you set everything up, all those cool scripts that Ubuntu has don't exist in Arch. The thing about these configs is that they are generally easy and give you a much better understanding of Linux. I guess I should make another post just for the howto.

Razer Anasi on Arch Linux

I have been using a Mac Razer Anasi at work, the macro keys are great but alone the keyboard is amazing to type on. I bought the windows version to use with Linux knowing full well it wouldn't work. I had already tested the Mac version and done some research, no one smarter than me had figured out how the razer drivers trigger changing the macro keys from really standard key codes like = - 0 9 8 and various other hard to map keys because mapping them would make much of the keyboard unusable. I had been watching this post on SuperUser http://superuser.com/questions/342107/getting-macro-keys-from-a-razer-blackwidow-to-work-on-linux and there were some good ideas, I was going to use this as a starting point to try and figure out how it all worked. Well someone else beat me too it and I'm glad they did, looking at what they did I don't know if I would have easily figured it out. Basically a command can be sent to the keyboard to change the scan code for each keyboard macro key. So following the instructions from SuperUser and using some of the information learned with the Logitech Trackpad we can assign any of the macro buttons.


First install cabal, ghc and libusb


sudo pacman -S cabal-install ghc libusb


Now we need to update cabal and install the usb module


cabal update; cabal install usb


now clone the git repository for EnableRazer


git clone git://github.com/tuxmark5/EnableRazer.git


I'm using the Anasi so the product ID needs to be changed in Main.hs


gedit src/Main.hs


line 64 is where the product ID goes, use lsusb to find the id of your ID, first part should be 1532 because that is Razers company ID. Its a small program so building and configureing EnableRazer is very quick.


cd EnableRazer/; cabal configure; cabal build


copy the binary to somewhere in your path, I used /usr/local/sbin because it is locally built and root is required to run


sudo cp dist/build/EnableRazer/EnableRazer /usr/local/sbin/


and run it


sudo EnableRazer


this should give you this output


WRITING SET_REPORT


OK


now use xev to see the changes, the t2, t3 and t4 will need to be remapped using udev because they default to trackad toggle, trackpad on and trackpad off. They don't work do anything useful and every easy way of remmaping did not work.

Computer got hosed

So arch wasn't downloading anything from AUR, I went through all kinds of steps to try and fix it, nothing worked. I left on a trip for a few days and when I cam back AUR was working again, I though all was good until I started some updates, first none were found so I just tried installing some stuff, thats when I figured out my installed package database was gone. After the fact I learned how to backup a list of installed packages and even how to restore your installed packages based on a log file. This is where I will say don't cut corners, follow the wiki and don't think you have a faster way. Instead of recreating my installed file list I just reinstalled all files. Well a reboot later and computer wouldn't boot. My mkinitcpio.conf was overwritten with the base defaults. At boot there was no LVM loaded and thus no boot :-(. Well two hours later everything was up and running, very glad I use seperate LVM drives for configuration files, backups and the such. There are quite a few parts that I cannot easily backup that way, so now I get to go through getting all my hardware to work again. First up is my Razer Anasi.I use some of the macro keys to send ir events through lirc to control my tv, I didn't realize how much I used this so now on to getting that working again.

Friday, February 17, 2012

Logitech Wireless Touchpad

So I got the Logitech wireless touchpad today, did a quick search on google and confirmed it works on linux. Naturally I assumed it interacted as a multitouch touchpad just like a synaptics touchpad. Well from my initial findings it does not. It seems to take on the role of interpreting the multitouch events on the device and send keyboard presses for different events. These are, of course, mapped to common keyboard commands on Windows. After a little playing with the device, which out of the box works great on linux, I started to figure out the keyboard commands. This is where my very recent trials getting the very awesome Razer Anasi working with all macro keys working came in handy. From what I learned through this simple post http://askubuntu.com/questions/69804/how-do-i-change-the-keymap-of-a-single-device-logitech-presenter I knew I could remap the keyboard events to whatever key I wanted. Using this command

sudo /lib/udev/keymap -i /dev/input/by-id/usb-Logitech_USB_Receiver-event-mouse

I figured out the scan codes for all the gesuteres logitech talks about on this page http://logitech-en-amr.custhelp.com/app/answers/detail/a_id/26426/~/gesture-navigation-with-the-logitech-wireless-touchpad

Here is my "map" of the gestures

Three Down
scan code: 0x7004E   key code: pagedown
Three Up
scan code: 0x7004B   key code: pageup
Three Left
scan code: 0x90004   key code: 113
Three Right
scan code: 0x90005   key code: 114
Four Down
scan code: 0x700E3   key code: leftmeta
scan code: 0x70007   key code: d
Four Up
scan code: 0x700E2   key code: leftalt
scan code: 0x7002B   key code: tab
Four Right
scan code: 0x700E3   key code: leftmeta
scan code: 0x7004F   key code: right
Four Left
scan code: 0x700E3   key code: leftmeta
scan code: 0x70050   key code: left

You can see how Logitech did things each gesture comes out as a keyboard press, the one really cool bonus of the keyboard output is that this device should work without any special drivers. The bad part, no custom gestures (not that I've gotten utouch to work under arch anyway). Next all you need to do is create the keymap for the touchpad, I created a file, /lib/udev/keymaps/logitech-touchpad

0x7004E hiragana #Three Down, screendown
0x7004B kpjpcomma # Three Up, screenup
0x90005 leftmeta #Three Right, Activities
0x90004 back #three Left, Back
0x700E2 leftalt #Four up 1
0x7002B f11 #Four up 2, toggle maximized state
0x700E3 leftalt #Four down 1
0x70007 f7 #Four Down 2, Move window
#0x700E3 First part of four right
#0x7004F second part of four right
#0x700E3 First part of four right
#0x70050 second part of four right

The first two are what I'm already using on my keyboard to switch desktops using xbindkeys. Its really easy to configure and I'm sure could write a little post about it if needed. I'm hoping the rest of the remappings make sense,

Now just use this command to remap the touchpad on the fly, if you are going to use different mappings this is very useful for testing.

sudo /lib/udev/keymap /dev/input/by-id/usb-Logitech_USB_Receiver-event-mouse /lib/udev/keymaps/logitech-touchpad

And I have some fun and functional gestures.

The next step is to make a udev rule to load this whenever the device is detected, however I don't intend to restart my computer for a while now so I haven't built the udev rules, I'll follow up with my rule when I make it, otherwise check out the askubuntu.com post. I also hope to post about my fun with the Razer Anasi - the tricks to get it working might also give us clues to unlocking more gestures with the Logitech device.