søndag den 6. marts 2011

Linux: Running a command/script after resuming from sleep

I've got myself a Asus Eee Top 1602, which I really want to run linux (gentoo) on.

I've got most of the stuff on it working, both the touchscreen, audio and wifi.

There are two issues left:
 * The volume keys on the front don't work, and
 * after I resume from suspend, the display is dimmed to something like 50%.

Previous issues have been:
 * Getting the wifi to work, and
 * Getting the wifi to work after resume.

Things I haven't looked at yet:
 * Memory card reader

Let me just give the some info to the eee top 1602:
 # lspci
00:00.0 Host bridge: Intel Corporation Mobile 945GME Express Memory Controller Hub (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GME Express Integrated Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/GME, 943/940GML Express Integrated Graphics Controller (rev 03)
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 02)
00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 (rev 02)
00:1c.3 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 4 (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 02)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e2)
00:1f.0 ISA bridge: Intel Corporation 82801GBM (ICH7-M) LPC Interface Bridge (rev 02)
00:1f.2 IDE interface: Intel Corporation 82801GBM/GHM (ICH7 Family) SATA IDE Controller (rev 02)
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 02)
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)
02:00.0 Network controller: RaLink RT2860
# lsusb
Bus 001 Device 005: ID 0bda:0158 Realtek Semiconductor Corp. Mass Storage Device
Bus 001 Device 006: ID 0458:7063 KYE Systems Corp. (Mouse Systems)
Bus 001 Device 003: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 002: ID 1bfd:1688 TouchPack Resistive Touch Screen
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 04f2:0402 Chicony Electronics Co., Ltd
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


Getting wifi to work
I'm using the staging driver in the kernel.
It's under: Device Drivers -> Staging drivers ->  Ralink 2860/3090 wireless support
You can compile it as a module or built it into the kernel, it dosen't matter.
What matters, is that you go go Ralink's website, and download the firmware file rt2860.bin, otherwise you'll just get something like this in dmesg when you "up" the wifi:
eeeTop kernel: [ 1321.424360] rt2860 0000:02:00.0: firmware file rt2860.bin request failed (-2)
eeeTop kernel: [ 1321.424378] ERROR! NICLoadFirmware failed, Status[=0x00000001]
eeeTop kernel: [ 1321.424397] rt28xx Initialized fail!

You'll find that here: http://www.ralinktech.com/support.php?s=2 and you'll need to get the PCI firmware of course.
Download that, extract, and place it under /lib/firmware (you might have to create the directory).

After this, I just emerged wpa_supplicant, and I'm able to connect to my wifi (WPA2 protected).

Getting wifi to work after resume
I found out that after the machine has been put in suspend, and reawaken, the wifi does work reconnect.
wpa_supplicant still reports the wifi as connected (with an IP adress and all that, but there's no connection).
I've read some people have some success by disabling some kernel options (specifically wireless extensions), but that  did not work for me.
Instead 'm just restarting the wifi after the machine resumes.
First I thought of using acpid, but I could not find see that that reports any suspend/resume events.
Anyway acpi is old, and maybe deprecated, now with hal (which is also deprecated) and policykit/consolekit, the last one being the future.
I've moved the system completely over to consolekit/policykit, and it work 100% now. (power management, shutdown, suspend, hibernate). But how to migrate was not that well documented, but thats a different story.

I found the solution to be pm-utils.
Even though it is written for HAL, it seems to work for consolekit as well.
Best of all, it is very easy to setup.
Under /etc/pm/ you'll find the configuration.

Under /etc/pm/sleep.d/ I just made a new file 50wifi, and put this in it:
#!/bin/bash
case $1 in
   hibernate)
       echo "Hibernating"
       ;;
   suspend)
       echo "Suspending"
       ;;
   thaw)
       echo "Returning from hibernation"
       /etc/init.d/net.wlan0 restart
       ;;
   resume)
       echo "Returning from suspend"
       /etc/init.d/net.wlan0 restart
       ;;
esac

Next, just make the file executable:
# chmod +x /etc/pm/sleep.d/50wifi

And thats it.
Now, every time the computer comes back from suspend or hibernation it restarts my wireless, and my connection is back within seconds.

I might update the blog, once I the re two remaining issues resolved.
I can live without the volume keys, but the dimmed display really needs to be fixed.

tirsdag den 15. februar 2011

Mini-itx cases, why is it so hard to find one that fits your needs?

Ok, so I've bought myself a new computer, this is going to be my "master" computer (which includes some gaming), and since I'm a little nuts I've decided that it should be as small as possible.
This means mini-itx!

However, it's not much fun having a high performance pc, and use on-board graphics, since these chips are usually only good for 2D and very light 3D.
So I also need room for a PCI-e graphics card and hence a somewhat powerful power-supply.

Lets just look at the PSU for a moment.
I'm using a Intel core i5-2500K and a Intel DH67CF motherbaord, spec'ed with 8 gb of kingston ram, with this I'm using a Consair P128 SSD.
This means a power draw between 35 and 130 watts.

None of the cases I've seen comes with a PSU thats near powerful enough (typically they're around 60W), but bying a picoPSU-150-XT would do the trick.

Now, what happens when I add a graphics card?
Ouch!
Here, no small PSU can be of any help :-(

This is especially true, when the card I'm going to use (for the moment) is a nVidia 8800GTS, which usesalot of power in idle, and much more when under load.
I really don't want to add ~100 watts to this system, since:
  1. It'll add another fan with all the noise thats brings.
  2. More heat, and I really don't want this in a small case.
  3. My energy bill will be much higher.

Well, for me, only one solution comes to mind. Plug in the graphics card when I want to do serious gaming, and leave it disconnected for my everyday computer-use.

I don't game that much. I do some programming, and gimp'ing, but the built-in Intel HD3000 graphics can handle this just fine.

Offtopic: Taking of power, did you know that most power-supplies are most effective at around 80% load?

So a picoPSU-150-XT for everyday use, and something else for gaming, or maybe just use a silverstone ST45SF PSU for it all.

If these where my only requirements for a case I would be fine, because there are lots of (mostly square) boxes that uses SFX PSU's and has room for a dual PCI-e card.

The problem is, that I really want a slim desktop case that sits under my monitor.
Now, by slim I mean less then 70mm!

I started my search at mini-itx.com/store, but found no cases that were up to the task.
So what candidates have I found?

Gigabyte
Gigabyte makes a series thats called MIB, I like the MIB T5142. Here are some images:

Now, I didn't notice this at first, but look at the last picture (of the back). Look how the motherboard is placed. Where is the PCI-e connector placed?
Thats right, all the way to the right, right next to the case edge (and no riser card/extension calbe I've found can reach).
Ok, there's no slot for the graphics card either, but I own a dremel, so thats no problem. I've cut these kinds of holes before.

I like the design, and the idea that the monitor is a part of it.
There is also ample room inside for a bigger power supply, harddrive and cdrom.
These cases are (WxDxH): 445 x 250 x 65  mm

Unfortunately, the MIB T5142 is not sold in eurupe, only the T5140:

But I don't like the front.
If I wanted this, I would move the motherboard to the left so a normal angled riser card would do the trick.

Then I found the Jetway JC-110-B:


I don't think it is as pretty, but it has the motherboard in the right place, and it's much smaller.
In fact, it's only (WxDxH): 300 x 273 x 65  mm
Jetway also makes two other models with the same sizes, but different fronts.
The jetway cases comes with a set of brackets to mount the case under your table or on the wall, which I think is a plus, because the case is too small for my monitor stand to fit on top of it.
On the down side, there's no audio port the the front/sides.

Silverstone cases:
There's the LC09:

It's 346 mm (W) x 55 mm (H) x 310 mm (D).
It has audio/usb in the side, and the motherboard in the right place, but I don't like the how the top plate looks. Why does it have to stick out over the rest of the case like that?
Also, given it's only 55mm high, I might not be able to fit the SFX PSU in there...
Oh, and lastly, the expansion port is only 1, which might not work with the dual design of the 8800GTS I have.

Then, there's the LC05:
Which is 346 mm (W) x 55 mm (H) x 300 mm (D).
But there's no expansion port(s), and the motherboard is placed wrong, like the MIB T5140/2.

Lastly there's the LC19:
It is 390 mm (W) x 68 mm (H) x 348 mm (D), and also available in black.
It's so large it can take a microATX motherboard.
There's audio, usb and card reader in the front (under the cover).
My only problem with this is, that it's deep. Almost 35 cm!

G-Atlantic
The GA620iBK-P4:

(with wall mount)


There are 3 different fronts for the case, the above in model A, which I quite like.
It's 300 (W) x 65 (H) x 273 (D) and comes with a 120W PSU (so I might not need the picoPSU)

There's also the GA630iBK-P4, which as far as I can are the same, but with a curved front:

or if you don't need the expansion ports, but want a smaller case, go with the GA688iBK-P4:

at only 220 (W)  x 65 (H) x 305 (D) mm


Casetronic
There's the c137:

 and the c158:

For info, see the chart below.
I think the finish is nice, but very industrial.
The c158 is just 54mm high, which might be a problem.

Here all info in a nice chart:

manufacture model h w d psu (w) cdrom exp fa fu cr type tag
gigabyte mib t5142 65 445 250 65 normal 0 y y n Mini-itx -eu
gigabyte mib t5140 65 445 250 65 normal 0 y y n Mini-itx
jetway  JC-110-B 65 300 273 100 slim 2 n y n Mini-itx
silverstone lc19 68 390 348 120 slim 1 y y y Micro-atx
silverstone lc05 55 346 300 60 normal 0 y y n Mini-itx
silverstone lc09 55 346 310 60 slim 1 y y n Mini-itx
Morex  2799 p4 64 295 288 150 slim 2 y y n Mini-itx ugly
Coolermaster Elite 100  70 262 318 150 slim 0 y y n Micro-atx
Casetronic c137 69 323 254 120 slim 2 n n n Mini-itx
Casetronic c158 54 305 279 120 slim 2 y y cf Mini-itx
G-alantic GA620iBK-P4 65 300 273 120 slim 2 n y n Mini-itx
h = height (mm)
w = width (mm)
d = depth (mm)
exp = full height expansion ports/brackets
fa = front audio jacket
fu = front usb port(s)
cr = card reader

The table became a little less readable because blogspot cropped the last text, so I had to shorten the whole table.


There are many others, but some simply look too flimsy, or are to high.
Search ebay for "mini-itx cases" and be inspired :-)

Other manufactures that makes products that almost fit my needs:
Evercase
Morex
Thermaltake
InWin
Chenbro


So, as it turns out, it isn't hard at all, your just need to know where to look.

I going with a G-Alantic GA6?0iBK-P4 or one of the casetronic's, as they look nice, has the size I'm going for, has a decent power supply I can use for everyday use, has the expansion port(s) I need.

Good hunting.

lørdag den 29. maj 2010

Getting your multimedia keys/remote control to work under X11 - by hacking your kernel

Right, so I have a media center (who doesn`t these days), and ofcourse a remote control for it.
My problem is, that I`ve got a Logitech ultraX media remote.
It is a nice remote, but only some of of the keys on the remote works out of the box
Heres the story of how I got all of my keys working.


The underlying problem
The underlying problem to all of this is that X11 does not support more then 255 different keys.
This is fine for most purposes, but not many media keys are included in these 255 keys.
Meny (if not all) common keys are mapped with a low keycode (range 0 to 200 (like letters and numbers), but many specialized meida keys are mapped much higher.

Testing to see if your keys really are dead in X
The first thing I did when trying to get the keys working, was running xev, which tells me if X recieves the input (key press in my case), and what that input is mapped to.
The problem was, that xev didn`t recieve any input from the buttons that did not work.
If your key press is detected in xev, this guide is NOT for you!
This guide is for getting your keys to register in X (xev)!

Solutions/Remedies for the problem?
After googling a bit I quickly found a MultimediaKeys guide on the gentoo-wiki.com site, which suggested running "showkey" from a real console (to open a real console hit alt-ctrl-f1).
When doing so, it registered my input, and showed a corrosponding keycode, but no scancode.
Output from showkey, when pressing some of the non-working keys in X (subtitle, language, dvd, music and repeat keys on the remote were pressed here):
showkey
kb mode was UNICODE
[ if you are trying this under X, it might not work
since the X server is also reading /dev/console ]

press any key (program terminates 10s after last keypress)...
keycode 28 release
keycode 370 press
keycode 370 release
keycode 368 press
keycode 368 release
keycode 389 press
keycode 389 release
keycode 391 press
keycode 391 release
keycode 129 press
keycode 129 release
The first line above (keycode 28 release) is the enter key being released (after executing the command).

I didn`t note it at the time, but the buttons that worked had keycodes lower then 255, and those that did not had keycodes higher then 255.
TAKE NOTE OF THIS, IT IS IMPORTANT!

So, first I thought it was because the input did not generate any scancodes (showkey -s shows generated scancodes, and showkey -k shows generated keycodes) - (but none of the keys do, and some of them work), so that wasn`t it.
So I hacked around a bit to generate some fake scancodes, but this was/is a dead end, and is not needed.

Using keytouch
The gentoo wiki guide suggested using a application called "keytouch" to get the keys working.
The keytouch application is used as a system service, and translates keycodes higher then 255 to lower keycodes, or it can map key presses directly to program commands.
I`ve tried keytouch; When starting the service (you can only do this after you`ve selected a keyboard/remote or created your own), I get this output (which means it does not work):
* Service keytouch starting
keytouch-init: Failed to set keycode:
keycode 148 to scancode -57260 (0xffff2054)
keytouch-init: Failed to set keycode:
keycode 149 to scancode -57260 (0xffff2054)
keytouch-init: Failed to set keycode:
keycode 202 to scancode -57260 (0xffff2054)
keytouch-init: Failed to set keycode:
keycode 203 to scancode -57260 (0xffff2054)
keytouch-init: Failed to set keycode:
keycode 227 to scancode -57260 (0xffff2054)
keytouch-init: Failed to set keycode:
keycode 141 to scancode -57260 (0xffff2054)
keytouch-init: Failed to set keycode:
keycode 225 to scancode 786 (0x312)
keytouch-init: Failed to set keycode:
keycode 224 to scancode 786 (0x312)
keytouch-init: Failed to set keycode:
keycode 231 to scancode -57260 (0xffff2054)
keytouch-init: Failed to set keycode:
keycode 124 to scancode -57260 (0xffff2054)
keytouch-init: Failed to set keycode:
keycode 235 to scancode -57260 (0xffff2054)
keytouch-init: Failed to set keycode:
keycode 219 to scancode 786 (0x312)
keytouch-init: Failed to set keycode:
keycode 147 to scancode -57260 (0xffff2054)
keytouch-init: Failed to set keycode:
keycode 129 to scancode -57260 (0xffff2054)
* Service keytouch started
So, no luck there :-(

Alternate solution - hacking the kernel
I figured the easiest way would then be to just change the mapping of the non-working keys to a lower keycode, this way I also don`t need yet another system service running, and I really want as few of those as possible (both to reduce system boot time, and to conserve system ressources).
The next step requires compiling your own kernel.
If you don`t know how, read the documentation for your distro (it's not covered here).
I`m running gentoo linux on all of my systems, so I`m quite comfortable compiling my own kernel, so heres what you need to do, once you know how (and has otherwise configured your kernel correctly for your own system).

Determine what keycodes needs to be remapped
Run showkey from a real console (as described above), and write down all the keycodes for the keys that does not work.
Note: showkey shows the keycodes in decimal form, and later you`ll need them in hex, so you may want to convert the numbers as you write them down.
For instance, take the Subtitle key from the showkey output above, it has a keycode of 370 in decimal, and thus becomes 0x172 in hex.

Remap the keys
Now edit /usr/src/linux/include/linux/input.h
In this file you will find all the defines for the keycodes that the linux kernel can generate.
Now, search for the keycodes you`ve noted down (remember to search for the converted hex numbers).
Once you have found a #define match, change the value to something lower then 248 (Range 248 - 255 is reserved for special needs of AT keyboard driver acording to a comment in input.h) - (you don`t have to write the value down in hex, you can write it in decimal if you want).
You`ll be remapping your keys to a keycode that most likely is already used, and the system won`t know the difference between these, so think about how you remap!

For the subtitle example, here the relevant part of input.h (lines 472 to 477):
#define KEY_LANGUAGE 0x170
#define KEY_TITLE 0x171
#define KEY_SUBTITLE 0x172
#define KEY_ANGLE 0x173
#define KEY_ZOOM 0x174
#define KEY_MODE 0x175
I`v changed the value of KEY_SUBTITLE to 183.
This means that the susbtitle button will ack like the F13 key (because it has a keycode value of 183) - (which I don`t have on my keyboard, and don`t use - since I have never heard of it).
You can also remap them directly to something else, like the arrow keys, if you know how you are going to use them.
For instance if you are going to use them in mythtv, or some other application where you`ll need s, m or any other key, this might be simpler, however it does not give you as much control over your keys as they will always ack like and s or a m.

I`ve remapped every key on the remote having a higher keycode then 255, to something else f14,f15...f24 and others.

Save, recompile and reboot
Once done, save input.h, and recompile your kernel (do a make clean first, to ensure the new values are used).
Now install your new kernel and reboot.

Testing if it works
Once rebooted, start X, fire up xev, and viola, all your keys now work (as whatever you remapped them to).


Why the 255 limit?
Q: So why does X only allow for 255 keys?
A: I don`t know!
The X11 protocol was released in 1985, and they properly didn`t think it was an issue.
The problem shound be fixed in X12, but no-one really knows when this is comming out.

Are there any drawbacks?
Yep, sure:
  • One drawback to this is that you can`t use one key to create keycombo`s.
  • Every time you update to a new kernel, you`ll have to patch it with your own remapped values.

Any suggestions?
I suggest remapping to the f13...f24 keys, and then let mythtv, xbmc or xmodmap remap the keys from there, as it gives you more control, and the abillity to make key combinations (keycombo`s).

References

tirsdag den 25. maj 2010

HTC Internet sharing and linux (gentoo)

As previous mentioned, I have a HTC Tattoo, and now that I've gotten familiar to it, I really like it.

Now, on topic:
The HTC Tattoo offers a "Internet sharing" option when it is connected to a computer via USB.
The driver installation on Windows sucks (at least on Danish windows installs - as it fails without installing the drivers), however, under linux, all you need is a couple a modules, and you're ready to go.

Here's the dmesg output when I connect the phone:
[101272.454938] hub 1-6:1.0: state 7 ports 4 chg 0000 evt 0002
[101272.455227] hub 1-6:1.0: port 1, status 0101, change 0001, 12 Mb/s
[101272.559111] hub 1-6:1.0: debounce: port 1: total 100ms stable 100ms status 0x101
[101272.570240] hub 1-6:1.0: port 1 not reset yet, waiting 10ms
[101272.632287] usb 1-6.1: new high speed USB device using ehci_hcd and address 18
[101272.644235] hub 1-6:1.0: port 1 not reset yet, waiting 10ms
[101272.725235] usb 1-6.1: default language 0x0409
[101272.731235] usb 1-6.1: udev 18, busnum 1, minor = 17
[101272.731241] usb 1-6.1: New USB device found, idVendor=0bb4, idProduct=0c01
[101272.731246] usb 1-6.1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[101272.731252] usb 1-6.1: Product: Android Phone
[101272.731257] usb 1-6.1: Manufacturer: HTC
[101272.731261] usb 1-6.1: SerialNumber: SH9CVLG00376
[101272.731390] usb 1-6.1: uevent
[101272.731423] usb 1-6.1: usb_probe_device
[101272.731430] usb 1-6.1: configuration #1 chosen from 1 choice
[101272.733488] usb 1-6.1: adding 1-6.1:1.0 (config #1, interface 0)
[101272.735621] usb 1-6.1:1.0: uevent
[101272.735661] usb-storage 1-6.1:1.0: usb_probe_interface
[101272.735672] usb-storage 1-6.1:1.0: usb_probe_interface - got id
[101272.735760] scsi9 : SCSI emulation for USB Mass Storage devices
[101272.735924] drivers/usb/core/inode.c: creating file '018'
[101272.735963] usb-storage: device found at 18
[101272.735966] usb-storage: waiting for device to settle before scanning
[101272.759587] usb 1-6.1: uevent
[101275.271385] hub 1-6:1.0: state 7 ports 4 chg 0000 evt 0002
[101275.271598] hub 1-6:1.0: port 1, status 0101, change 0001, 12 Mb/s
[101275.271605] usb 1-6.1: USB disconnect, address 18
[101275.271610] usb 1-6.1: unregistering device
[101275.271615] usb 1-6.1: usb_disable_device nuking all URBs
[101275.271624] usb 1-6.1: unregistering interface 1-6.1:1.0
[101275.274280] usb 1-6.1:1.0: uevent
[101275.274530] usb 1-6.1: uevent
[101275.379244] hub 1-6:1.0: debounce: port 1: total 100ms stable 100ms status 0x101
[101275.390236] hub 1-6:1.0: port 1 not reset yet, waiting 10ms
[101275.452284] usb 1-6.1: new high speed USB device using ehci_hcd and address 19
[101275.464233] hub 1-6:1.0: port 1 not reset yet, waiting 10ms
[101275.543241] usb 1-6.1: skipped 4 descriptors after interface
[101275.545238] usb 1-6.1: default language 0x0409
[101275.551238] usb 1-6.1: udev 19, busnum 1, minor = 18
[101275.551243] usb 1-6.1: New USB device found, idVendor=0bb4, idProduct=0ffe
[101275.551249] usb 1-6.1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[101275.551255] usb 1-6.1: Product: Android Phone
[101275.551259] usb 1-6.1: Manufacturer: HTC
[101275.551263] usb 1-6.1: SerialNumber: SH9CVLG00376
[101275.551383] usb 1-6.1: uevent
[101275.551418] usb 1-6.1: usb_probe_device
[101275.551425] usb 1-6.1: configuration #1 chosen from 1 choice
[101275.553481] usb 1-6.1: adding 1-6.1:1.0 (config #1, interface 0)
[101275.553898] usb 1-6.1: uevent
[101275.555614] usb 1-6.1:1.0: uevent
[101275.555660] usbserial_generic 1-6.1:1.0: usb_probe_interface
[101275.555666] usbserial_generic 1-6.1:1.0: usb_probe_interface - got id
[101275.555687] rndis_host 1-6.1:1.0: usb_probe_interface
[101275.555692] rndis_host 1-6.1:1.0: usb_probe_interface - got id
[101275.569291] usb0: register 'rndis_host' at usb-0000:00:1d.7-6.1, RNDIS device, fa:6a:94:9d:b9:49
[101275.569324] usb 1-6.1: adding 1-6.1:1.1 (config #1, interface 1)
[101275.570622] usb 1-6.1:1.1: uevent
[101275.570691] drivers/usb/core/inode.c: creating file '019'
[101276.342616] usb 1-6.1: link qh32-0001/f6435900 start 11 [2/0 us]
and lsusb has this to say:
Bus 001 Device 019: ID 0bb4:0ffe High Tech Computer Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 2 Communications
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0bb4 High Tech Computer Corp.
idProduct 0x0ffe
bcdDevice 1.00
iManufacturer 3 HTC
iProduct 2 Android Phone
iSerial 1 SH9CVLG00376
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 67
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 256mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 255 Vendor Specific (MSFT RNDIS?)
iInterface 6 HTC Ethernet Sharing
CDC Header:
bcdCDC 1.10
CDC Call Management:
bmCapabilities 0x00
bDataInterface 1
CDC ACM:
bmCapabilities 0x00
CDC Union:
bMasterInterface 0
bSlaveInterface 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 9
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 6 HTC Ethernet Sharing
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
bNumConfigurations 1
Device Status: 0x0000
(Bus Powered)
For this to work, I have enabled the following modules in my kernel:
rndis_host
cdc_ether (with rndis support)
usbnet

These are found under:

  • Device Drivers --->
    • Network device support --->
      • USB Network Adapters --->
        • Multi-purpose USB Networking Framework
        • Host for RNDIS and ActiveSync devices (EXPERIMENTAL)
    • USB support --->
      • USB Gadget Support --->
        • Ethernet Gadget (with CDC Ethernet support)
        • [*] RNDIS support

Next, you'll just need to create a symlink from net.lo to net.usb0 in /etc/init.d/
cd /etc/init.d/
ln -s net.lo net.usb0
This will get the device working under gentoo at least.

lørdag den 30. januar 2010

Installing linux (gentoo) on a usb pen...

I've just received my newest toy; a Zotac ITX-F board (Atom N330 and nVidia ION).
I'm going to use it as my media center because (oddly enough) it is the only Pc in my house that can play 1080p files (because of the vpdau support in mplayer).

The real issuse here was to install gentoo on it. First I wanted to do a NFS (diskless) install on it, but since my server is only running 32bit gentoo, I could not chroot into the new installation dir.
Instead I decided to use a 8gig usb pen drive, and just use that as primary storage.

The installation went just fine, but once rebooted the kernel would panic and complain about not being able to mount root:
Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "sda2" or unknown-block(2,0)
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

I found out you have to append rootdelay option to your kernel, this should give the usb storage time to settle and thus be scanned and become available to the system.

My kernel boot line is now:
kernel /boot/kernel-2.6.31-r7 root=/dev/sda2 video=uvesafb:1280x1024-32@60,ywrap,mtrr:3 rootdelay=5

And it works :-)


And just a note on my previous post.
I found two program that might do the trick:
  • GO Contact sync (http://www.webgear.co.nz/Products/GOContactSync.aspx)
  • Sync2 for Microsoft® Outlook® (http://www.sync2.com/)
GO Contact sync is open source, and thus free, but I could not get the program to work (Match not found).
The other program is not free, but you can download it as a fully functioning trial, and so I did.
It works, and syncs like it should, with just one exception: It does not sync contact images (luckily the HTC Tattoo can match people with their facebook profiles, so I'll just just the profile pictures from facebook).

torsdag den 28. januar 2010

I got myself a new phone: Meet HTC Tattoo

For the amount this phone costs, it is atually quite nice.

Theres just one thing I wanted to share with you for now.
If you configure more then one calendar on the thing, you can't select which one is the default.

I found out that the phone just uses the first one you set up.

So, after having configured my Exchange calendar (for work) and google calendar(for private) use, I had to delete my Exchange, and create it again.

Otherwise it would select the Exchange as default, and I dont want to accidentially add my personal stuff to my work calendar.

Now, the next challenge is to add my contacts (with pictures) to it.
I know I can import contacts to google via CSV file(s), but this does not contain the picture (also there are some teouble using this method, since my outlook is in danish, and the csv file's header is in danish, so they don't match what google's import expect's).