Saturday, May 2, 2009

HP remote control in ubuntu ....how to get it working ....

Got a new laptop couple of months ago :D
HP Pavilion dv5 1104TU and it completely rocks ! :D

Well, it also came with a neat little remote control with lots of media buttons to make life easy. It worked perfectly under Vista, but refused to work with ubuntu (tried on 8.10 and 9.04). Now, I've finally come up with a way to get it working on Ubuntu.

Just follow this procedure and nothing can go wrong !

Firstly, you'll need to get lirc .
To install lirc, click here
Note : Select "none" and "none" when it asks for configuration during isntallation.

After that, download the configuration file for the Remote from here .This is the configuration file for the remote that comes with the DV6 series, but it works just fine with DV5 series too.

Now save this file as lircd.conf in /etc/lirc/

After this , edit the hardware.conf file to match this :

# /etc/lirc/hardware.conf
#
#Chosen Remote Control
REMOTE="None"
REMOTE_MODULES="lirc_dev lirc_serial"
REMOTE_DRIVER="default"
REMOTE_DEVICE=""
REMOTE_LIRCD_CONF=""
REMOTE_LIRCD_ARGS=""

#Chosen IR Transmitter
TRANSMITTER="None"
TRANSMITTER_MODULES=""
TRANSMITTER_DRIVER=""
TRANSMITTER_DEVICE=""
TRANSMITTER_LIRCD_CONF=""
TRANSMITTER_LIRCD_ARGS=""

#Enable lircd
START_LIRCD="true"

#Don't start lircmd even if there seems to be a good config file
#START_LIRCMD="false"

#Try to load appropriate kernel modules
LOAD_MODULES="true"

# Default configuration files for your hardware if any
LIRCMD_CONF=""

#Forcing noninteractive reconfiguration
#If lirc is to be reconfigured by an external application
#that doesn't have a debconf frontend available, the noninteractive
#frontend can be invoked and set to parse REMOTE and TRANSMITTER
#It will then populate all other variables without any user input
#If you would like to configure lirc via standard methods, be sure
#to leave this set to "false"
FORCE_NONINTERACTIVE_RECONFIGURATION="false"
START_LIRCMD=""


Save it

Go to the terminal and ..

 sudo /etc/init.d/lirc start 


and Voila ! if you have done everything correctly, the remote should be working now.
You can try it out from System->Preferences->Keyboard Shortcuts
Hope that helps ! :-)
Cheers !

Wednesday, December 17, 2008

Of Flash drives and Windows XP...Part II

Part I can be found here.

This part contains the workarounds !

How to fool Windows into thinking that the removable drive is a local disk :

This solution has been copied from here

I am posting the solution here too, just because its difficult to find the solution on that page :P.

Nearly all USB flash drives pretend to have a removable media (even it's a lie), so Windows detects them as 'removable'. On drives with a removable media Windows 2000 and higher supports only one partition.
Finally it's a single bit in the device's device descriptor, the removable media bit (RMB). If you take away the RMB then Windows sees the drive as 'local disk' and multiple partitions work.
The Removable Media Bit can be changed either in the drive's hardware or by a Windows filter driver.
Changing in the hardware works with some flash drives by means of the tool Lexar BootIt.

But this works only with some pen-drvies. It DID NOT work for me.

The second way to do this ...

A filter driver for removing the RMB has been made by Hitachi for their Microdrives (Compatct Flash cards with a mini harddrive):

xpfildrvr1224_320.zip

By modifying the included INF file the filter driver can be used with any other 'removable' drive.
For the device detection there are the lines in section [cfadisk_device]:

[cfadisk_device]
%Microdrive_devdesc% = cfadisk_install,IDE\DiskIBM-DSCM-11000__________________________SC2IC801

"IDE\DiskIBM-DSCM-11000__________________________SC2IC801" is the device ID of one of the supported Microdrives.

In analogy to these lines we add one line for each 'removable' USB drive we want to turn into an USB hard drive. The ID is found in the Windows device management: Expand 'Disk drives', right click your USB drive, select Properties. On the tab "Details" under XP the item "Device instance ID" is already selected. Click on the ID in the List and press Ctrl+C, this copies the ID into the Windows Clipboard and can be pasted somewhere else with Ctrl+V.
XP shows the tab "Details" only when the environment variable DEVMGR_SHOW_DETAILS=1 is set:
DevMgr_Show_1.reg download and doubleclick the file, then relogon to take effect.

Sample:
USBSTOR\DISK&VEN_LEXAR&PROD_JUMPDRIVE&REV_1.30\K326441127040&0
We need the fat part:

[cfadisk_device]
%Microdrive_devdesc% = cfadisk_install,USBSTOR\DISK&VEN_LEXAR&PROD_JUMPDRIVE&REV_1.30

In the last line of the INF file we change "Hitachi Microdrive" into something nice as "RemovableToFixed".

In the device manager again right-click the USB drive, "Update driver...", then "No, not this time" -> Next -> "Install from a list or..." -> Next -> "Don't search." -> Next -> "Have Disk" -> browse to the INF file here. Now "RemovableToFixed" should be in the list -> Next -> Confirm the two warnings -> Finish.
Now the drive is re-detected, actually as USB hard drive. The drive can be partitioned, and all the existing partitions are visible and usable.

Now, this solution works with all the USB flash drives. But the problem is that since this method requires installing a custom driver, the pen-drive is detected as a local disk only on the machine that uses that driver. All the other machines detect it as a removable drive. This essentially defeats the purpose of using a pen-drive !!

Re-arrangement of partitions :

This hasn't been copied from anywhere :P.

What i realized was that only the 1st physical partition was being assigned a letter. So i re-arranged the partitions within the flash drive as follows :

1) 2111 MB NTFS (for general use)
2)1024 MB ext2 ( for persistence)
3)700 MB FAT32, bootable.

This made the NTFS partition visible from Windows and i could use my flash drive as if it were a ~2 GB pen-drive.

Looking back, I actually liked this solution, since, whenever I use my pen-drive in the college, the viruses wont be able to mess up the FAT32 bootable partition ! and when I use Linux, all 3 partitions are being mounted anyway. The flip side was that sharing data between the partitions was impossible with Windows XP.....

So as it turned out, there is no concrete solution to using Flash drives with multiple partitions with Windows XP....just some workarounds, each with its pros and cons....

So what do you do if you wanna use a Flash drive with multiple partitions ? .....Use Linux :-)

Of Flash drives and Windows XP...Part I

As mentioned here, I faced quite an annoying problem when i created multiple partitions on my USB flash drive.

The layout of the Flash drive was as follows :

1)720 MB partition, FAT32, bootable
2)1024 MB partition ext2 (for persistence)
3)2111 MB parition, NTFS (for general use)

Now, the problem was that when the Flash drive was inserted when Windows XP was running, only 1 partition was being assigned a letter by Windows. The remaining partitions were visible from the Disk Management Tool, but were not being assigned a letter and as a result were rendered useless.
Any attempt to assign a letter to the drives resulted in the following error :
"The partition is not enabled. To enable the partition re-start the computer."

Restarting the computer does not help and the same error is displayed.
Now this was annoying, because the partition that was being assigned a letter was the 720 MB one, which was already filled up.

This problem is absent in Ubuntu. All the 3 partitions are detected and are usable. This problem is confirmed by Microsoft as a feature (lol :P).Only the first partition on the USB Flash drive is assigned a letter and is usable.

There are a couple of workarounds for this ....one is to fool Windows into thinking that the removable drive is a local disk. The other one involves rearrangement of partitions.

Workarounds can be found here.

Of Live USBs and MBRs

Determined to put my 4 GB flash drive to good use, i decided to create a Live USB disk of the Interpid Ibex on it.

Now, Ubuntu 8.10 comes with this neat "Live USB disk creator" tool, which makes it extremely easy to create a live disk.But on my friend Chinmay's blog, i read that this tool doesn't make the USB stick persistent. So, without trying it out myself, i headed here. Now this page describes how to install Ubuntu 8.10 on the USB stick.

After following all the steps mentioned there, i was unable to boot through my USB stick. It displayed some garbage on the screen and i was forced to restart the computer.

So now, I tried the Live USB creator tool, which led to the same problem as well !. One probable source of this kind of error can be a corrupted MBR. So i tried writing a MBR to the disk using lilo.

#lilo -M /dev/sdX

where, X is the letter assigned to the drive, which can be found out by doing a #fdisk -l .

And, as it turned out, this was the problem. Now, I was able to boot through my USB stick and everything seemed just fine. All the settings and documents were persistent. I again, formatted the USB stick and used the tool provided with the Intrepid, and surprisingly the settings and documents were persistent here too !. So Chinmay's might be an isolated problem....or mine an isolated success :P .

The major difference that i found out between the two methods was that the creator tool does not create separate physical partitions on the stick. It instead creates a file on the stick and uses it for persistent settings. On the other hand, the manual method creates a separate partition for keeping the settings persistent.

Now, my USB stick was ready ! ....well not exactly.....i faced quite an annoying problem in Windows while using this USB stick.

Since I'm running out of time, I will post the problem and some workarounds that I found out later.

Stay tuned :-D