Some interesting (odd?) Linux Tidbits

I've been running linux as my primary OS since 2.0.2x (twentysomething). I think RedHat 5.2 was the last distro to share a drive with Windows on one of my PCs. Over that time, I've had to deal with a number of unusual/undocumented behavior as well as fixes for new hardware. I plan to document as much as I can here as I get time.


Contents


Sony DSC-P50 with Linux 2.4.7

fixed in >=2.4.8

Requires a new change in unusual_devs.h. The following patch fixes it:

--- clean/drivers/usb/storage/unusual_devs.h    Sun Jul 29 17:39:01 2001
+++ new/drivers/usb/storage/unusual_devs.h      Sat Aug 11 21:46:40 2001
@@ -126,9 +126,9 @@
                "CD-RW Device",
                US_SC_8020, US_PR_CB, NULL, 0),

-UNUSUAL_DEV(  0x054c, 0x0010, 0x0106, 0x0210, 
+UNUSUAL_DEV(  0x054c, 0x0010, 0x0106, 0x0322, 
                "Sony",
-               "DSC-S30/S70/505V/F505", 
+               "Sony DSC", 
                US_SC_SCSI, US_PR_CB, NULL,
                US_FL_SINGLE_LUN | US_FL_START_STOP | US_FL_MODE_XLATE ),

Quick explanation: the third and fourth paramters in the UNUSUAL_DEV macro refer to the minimum and maximum version number that should match in order to use the flags specified (which I'm assuming are necessary for this particular device to work). Just increment the max from the current value to at least that which is used by your camera/device (in /proc/bus/usb/devices you should see an entry for your device with "Rev" as the tag preceding it. In my camera it's 3.22, hence the 0x0322.

Check dmesg or /var/log/messages to find out what device the camera got mapped to (it behaves as a scsi disk/device, FYI). In my case, it's usually /dev/sdb, so I do a mount /dev/sdb1 /mnt/camera -t vfat and all is good. :-)


Sony Vaio APM BIOS Minutes Remaining Fix

The following patch against 2.4.7 takes care of the minutes remaining problems with the Sony PCG-N505VX. Symptoms include randomly varying minutes remaining getting reported by the apm subsystem. Things like 226 hours remaining kind of weird.

Other Sony Vaios are included in the "real" patches from Stelian, and are being included in the 2.4.8-ac series. Search the lkml for patches or ac version numbers for more information.


diff -Naur --exclude-from=exclude linux-2.4.7/arch/i386/kernel/apm.c linux-2.4.7-sony/arch/i386/kernel/apm.c
--- linux-2.4.7/arch/i386/kernel/apm.c	Fri Apr  6 13:42:47 2001
+++ linux-2.4.7-sony/arch/i386/kernel/apm.c	Mon Aug 20 12:21:46 2001
@@ -704,7 +704,11 @@
 		return (eax >> 8) & 0xff;
 	*status = ebx;
 	*bat = ecx;
-	*life = edx;
+	if (apm_info.get_power_status_swabinminutes) {
+		*life = swab16((u16)edx);
+		*life |= 0x8000;
+	} else
+		*life = edx;
 	return APM_SUCCESS;
 }
 
diff -Naur --exclude-from=exclude linux-2.4.7/arch/i386/kernel/dmi_scan.c linux-2.4.7-sony/arch/i386/kernel/dmi_scan.c
--- linux-2.4.7/arch/i386/kernel/dmi_scan.c	Mon Aug 20 14:49:59 2001
+++ linux-2.4.7-sony/arch/i386/kernel/dmi_scan.c	Mon Aug 20 14:06:52 2001
@@ -251,6 +251,13 @@
 	return 0;
 }		
 
+static __init int swab_apm_power_in_minutes(struct dmi_blacklist *d)
+{
+	apm_info.get_power_status_swabinminutes = 1;
+	printk(KERN_WARNING "BIOS strings suggest APM reports battery life in minutes and wrong byte order.\n");
+	return 0;
+}
+
 /*
  *	Process the DMI blacklists
  */
@@ -297,6 +304,12 @@
 			MATCH(DMI_PRODUCT_NAME, "L8400K series Notebook PC"),
 			NO_MATCH, NO_MATCH
 			} },					
+	{ swab_apm_power_in_minutes, "Sony VAIO", { /* Handle problems with APM on Sony Vaio PCG-N505VX */
+			MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
+			MATCH(DMI_BIOS_VERSION, "W2K06H0"),
+			MATCH(DMI_BIOS_DATE, "02/03/00"), NO_MATCH
+			} },
+		
 	{ apm_is_horked, "Trigem Delhi3", { /* APM crashes */
 			MATCH(DMI_SYS_VENDOR, "TriGem Computer, Inc"),
 			MATCH(DMI_PRODUCT_NAME, "Delhi3"),
diff -Naur --exclude-from=exclude linux-2.4.7/include/linux/apm_bios.h linux-2.4.7-sony/include/linux/apm_bios.h
--- linux-2.4.7/include/linux/apm_bios.h	Wed Jul  4 14:50:39 2001
+++ linux-2.4.7-sony/include/linux/apm_bios.h	Mon Aug 20 12:18:14 2001
@@ -52,6 +52,7 @@
 	struct apm_bios_info	bios;
 	unsigned short		connection_version;
 	int			get_power_status_broken;
+	int			get_power_status_swabinminutes;
 	int			allow_ints;
 	int			realmode_power_off;
 	int			disabled;


Copyright ©2001 Sujal Shah
Last Modified: Monday, 20-Aug-2001 15:18:24 EDT