From 9591fd3d47586ff610a571315bb4dd7eb0fab9b4 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Fri, 9 Dec 2005 09:03:58 +0000 Subject: cset reimport: 312f38f709741998f8c01f5aaf6d1956ca0a76fb * groff * cdstatus * unslung stuff --- packages/cdstatus/cdstatus-0.96.05.bb | 4 +- packages/groff/groff/Makefile.in.patch | 31 + packages/groff/groff/Makefile.sub.patch | 21 + packages/groff/groff_1.19.2.bb | 23 + packages/linux/unslung-kernel/defconfig | 18 +- .../unslung-kernel/linux-kernel-R29_to_R63.patch | 6399 ++++++++++++++++++++ packages/linux/unslung-kernel_2.4.22.l2.3r63.bb | 24 +- packages/meta/unslung-image.bb | 4 +- packages/nslu2-binary-only/unslung-rootfs/unsling | 12 +- .../nslu2-binary-only/unslung-rootfs_2.3r63.bb | 2 +- 10 files changed, 6496 insertions(+), 42 deletions(-) create mode 100644 packages/groff/groff/Makefile.in.patch create mode 100644 packages/groff/groff/Makefile.sub.patch create mode 100644 packages/groff/groff_1.19.2.bb create mode 100644 packages/linux/unslung-kernel/linux-kernel-R29_to_R63.patch (limited to 'packages') diff --git a/packages/cdstatus/cdstatus-0.96.05.bb b/packages/cdstatus/cdstatus-0.96.05.bb index 1ae728f836..a2b3a0484a 100644 --- a/packages/cdstatus/cdstatus-0.96.05.bb +++ b/packages/cdstatus/cdstatus-0.96.05.bb @@ -1,6 +1,6 @@ # cdstatus OE build file -PR="r0" +PR="r1" LICENSE="GPL" HOMEPAGE = "http://cdstatus.sourceforge.net/" FILES_${PN} += ${datadir}/cdstatus.cfg @@ -12,8 +12,6 @@ S="${WORKDIR}/cdstatus-0.96.05" inherit autotools -TARGET_LDFLAGS="" - do_install() { install -d 0755 ${D}/${bindir} install -d 0755 ${D}/${datadir} diff --git a/packages/groff/groff/Makefile.in.patch b/packages/groff/groff/Makefile.in.patch new file mode 100644 index 0000000000..30aac8cbf0 --- /dev/null +++ b/packages/groff/groff/Makefile.in.patch @@ -0,0 +1,31 @@ +*** groff-1.19.2/Makefile.in.orig Sun Aug 7 10:03:33 2005 +--- groff-1.19.2/Makefile.in Sat Dec 3 16:44:50 2005 +*************** +*** 242,249 **** + + # The configure script checks whether all necessary utility programs for + # grohtml are available -- only then we can build the HTML documentation. +! make_html=@make_html@ +! make_install_html=@make_install_html@ + + # The configure script also checks whether all necessary utility programs + # for pdfroff are available -- only then we can build PDF documentation. +--- 242,249 ---- + + # The configure script checks whether all necessary utility programs for + # grohtml are available -- only then we can build the HTML documentation. +! make_html= +! make_install_html= + + # The configure script also checks whether all necessary utility programs + # for pdfroff are available -- only then we can build PDF documentation. +*************** +*** 549,555 **** + contrib/pic2graph \ + contrib/eqn2graph \ + contrib/grap2graph \ +- contrib/groffer \ + contrib/mom \ + contrib/pdfmark \ + contrib/gdiffmk +--- 549,554 ---- diff --git a/packages/groff/groff/Makefile.sub.patch b/packages/groff/groff/Makefile.sub.patch new file mode 100644 index 0000000000..1b5a7dfac5 --- /dev/null +++ b/packages/groff/groff/Makefile.sub.patch @@ -0,0 +1,21 @@ +*** groff-1.19.2/src/include/Makefile.sub.orig Thu Jun 23 13:27:53 2005 +--- groff-1.19.2/src/include/Makefile.sub Sat Dec 3 18:35:40 2005 +*************** +*** 39,46 **** + "DEVICE=\"$(DEVICE)\"" \ + "INSTALLPATH=\"$(prefix)\"" \ + "BINPATH=\"$(bindir)\"" \ +! "FONTPATH=\"$(fontpath)\"" \ +! "MACROPATH=\"$(tmacpath)\"" \ + "INDEX_SUFFIX=\"$(indexext)\"" \ + "COMMON_WORDS_FILE=\"$(common_words_file)\"" \ + "DEFAULT_INDEX_DIR=\"$(indexdir)\"" \ +--- 39,46 ---- + "DEVICE=\"$(DEVICE)\"" \ + "INSTALLPATH=\"$(prefix)\"" \ + "BINPATH=\"$(bindir)\"" \ +! "FONTPATH=\"/usr/share/groff/site-font:/usr/share/groff/1.19.2/font:/usr/lib/font\"" \ +! "MACROPATH=\"/usr/lib/groff/site-tmac:/usr/share/groff/site-tmac:/usr/share/groff/1.19.2/tmac\"" \ + "INDEX_SUFFIX=\"$(indexext)\"" \ + "COMMON_WORDS_FILE=\"$(common_words_file)\"" \ + "DEFAULT_INDEX_DIR=\"$(indexdir)\"" \ diff --git a/packages/groff/groff_1.19.2.bb b/packages/groff/groff_1.19.2.bb new file mode 100644 index 0000000000..7381bb3687 --- /dev/null +++ b/packages/groff/groff_1.19.2.bb @@ -0,0 +1,23 @@ +LICENSE = "GPL" +SECTION = "base" +DESCRIPTION = "GNU roff" +RDEPENDS="libstdc++6" +MAINTAINER = "Inge Arnesen " +SRC_URI = "http://ftp.gnu.org/gnu/groff/groff-${PV}.tar.gz \ + file://Makefile.in.patch;patch=1 \ + file://Makefile.sub.patch;patch=1 \ + file://groff.patch;patch=1" + +# prefix and exec-prefix are broken and the .in file is broken too +# and can't be autoreconf'ed, so specify every dir +EXTRA_OECONF="--prefix=${D} --exec-prefix=${D} --bindir=${D}/usr/bin --datadir=${D}/usr/share --mandir=${D}/usr/man --infodir=${D}/usr/share/info" +inherit autotools + +do_configure () { + oe_runconf +} + +#do_install() { +# oe_runmake 'PREFIX=${D}' install +#} + diff --git a/packages/linux/unslung-kernel/defconfig b/packages/linux/unslung-kernel/defconfig index d9a01070d5..110728b68e 100644 --- a/packages/linux/unslung-kernel/defconfig +++ b/packages/linux/unslung-kernel/defconfig @@ -982,24 +982,24 @@ CONFIG_NLS=y # Native Language Support # CONFIG_NLS_DEFAULT="iso8859-1" -# CONFIG_NLS_CODEPAGE_437 is not set -# CONFIG_NLS_CODEPAGE_737 is not set +CONFIG_NLS_CODEPAGE_437=m +CONFIG_NLS_CODEPAGE_737=m # CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set +CONFIG_NLS_CODEPAGE_850=m +CONFIG_NLS_CODEPAGE_852=m # CONFIG_NLS_CODEPAGE_855 is not set # CONFIG_NLS_CODEPAGE_857 is not set # CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set +CONFIG_NLS_CODEPAGE_861=m # CONFIG_NLS_CODEPAGE_862 is not set # CONFIG_NLS_CODEPAGE_863 is not set # CONFIG_NLS_CODEPAGE_864 is not set # CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set +CONFIG_NLS_CODEPAGE_866=m # CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set +CONFIG_NLS_CODEPAGE_936=m +CONFIG_NLS_CODEPAGE_950=m +CONFIG_NLS_CODEPAGE_932=m # CONFIG_NLS_CODEPAGE_949 is not set # CONFIG_NLS_CODEPAGE_874 is not set # CONFIG_NLS_ISO8859_8 is not set diff --git a/packages/linux/unslung-kernel/linux-kernel-R29_to_R63.patch b/packages/linux/unslung-kernel/linux-kernel-R29_to_R63.patch new file mode 100644 index 0000000000..cf1c83efbe --- /dev/null +++ b/packages/linux/unslung-kernel/linux-kernel-R29_to_R63.patch @@ -0,0 +1,6399 @@ +--- linux-2.4.22-r29/drivers/ixp400/Makefile 2005-11-27 21:09:09.000000000 +0100 ++++ linux-2.4.22/drivers/ixp400/Makefile 2005-11-27 21:25:15.000000000 +0100 +@@ -80,9 +80,9 @@ + # -- End Intel/GPL Copyright Notice -- + # + + ifdef CONFIG_IXP425_CSR +-include $(ROOTDIR)/IXP400lib/ixp400_xscale_sw/buildUtils/environment.linux ++# include $(ROOTDIR)/IXP400lib/ixp400_xscale_sw/buildUtils/environment.linux + # IX_XSCALE_SW=$(ROOTDIR)/IXP400lib/ixp400_xscale_sw/ + # The kernel makefiles override the value of CFLAGS on the make + # commandline. Because the xscale_sw makefile is supposed to be + # stand-alone, we don't want this. So we reset the special variable +@@ -136,15 +136,15 @@ + # This rule builds the modules. + # The dependency on modversions.h is needed here so it'll be built for + # us in a 'make modules'. + build_ixp400_modules: force $(TOPDIR)/include/linux/modversions.h +- cd $(IX_XSCALE_SW); $(MAKE) IX_NOSYM=1 $(REAL_IXP400_MODULES:$(IX_XSCALE_SW)/%=%) ++# cd $(IX_XSCALE_SW); $(MAKE) IX_NOSYM=1 $(REAL_IXP400_MODULES:$(IX_XSCALE_SW)/%=%) + + # After building the modules, we copy them to this directory as that's + # where the kernel makefiles expect to find them. We can't use + # symlinks, as Jungo's 'make ramdisk' rule would just copy the links. + $(IXP400_MODULES): $(REAL_IXP400_MODULES) +- cp $(IX_XSCALE_SW)/lib/linuxbe/$@ $@ ++# cp $(IX_XSCALE_SW)/lib/linuxbe/$@ $@ + + # This macro is the interface to the rules in $(TOPDIR)/Rules.make. It + # contains the names of all module files that can be built in this + # directory. Note that they must be filenames in this directory - the +--- R29/drivers/Makefile 2004-03-24 19:55:04.000000000 +0000 ++++ R63/drivers/Makefile 2005-08-30 06:06:00.000000000 +0100 +@@ -48,9 +48,4 @@ + subdir-$(CONFIG_PCF8594C2) += i2c/pcf8594c-2 + + subdir-$(CONFIG_BLUEZ) += bluetooth +- +-ifdef CONFIG_ARCH_IXP425 +-subdir-$(CONFIG_IXP425_CSR) += ixp400 +-endif +- + include $(TOPDIR)/Rules.make +--- R29/drivers/net/Makefile 2004-03-24 19:55:20.000000000 +0000 ++++ R63/drivers/net/Makefile 2005-08-23 06:20:03.000000000 +0100 +@@ -28,10 +28,7 @@ + obj-$(CONFIG_OCP_NET) += ibm_emac/ocp.o + + ifdef CONFIG_IXP425_CSR +-include $(ROOTDIR)/IXP400lib/ixp400_xscale_sw/buildUtils/environment.linux +-CFLAGS_ixp425_eth.o = -I$(IX_XSCALE_SW)/src/linux \ +- -I$(IX_XSCALE_SW)/src/include +-obj-m += ixp425_eth.o ++#obj-m += ixp425_eth.o + endif + + ifeq ($(CONFIG_E1000),y) +--- R29/drivers/scsi/hosts.c 2004-03-24 19:55:43.000000000 +0000 ++++ R63/drivers/scsi/hosts.c 2005-04-05 02:40:53.000000000 +0100 +@@ -36,12 +36,15 @@ + #define __KERNEL_SYSCALLS__ + + #include +- ++//pete ++#include ++#include ++// + #include "scsi.h" + #include "hosts.h" + + /* +-static const char RCSid[] = "$Header: /home/cvsroot/NSLU2/linux-2.4.x/drivers/scsi/hosts.c,v 1.1.1.1 2004/03/24 19:55:43 sure Exp $"; ++static const char RCSid[] = "$Header: /home/nas-cvsroot/NSLU2_V2/linux-2.4.x/drivers/scsi/hosts.c,v 1.2 2005/04/05 01:40:53 shearer Exp $"; + */ + + /* +@@ -84,6 +87,12 @@ + int max_scsi_hosts; /* host_no for next new host */ + int next_scsi_host; /* count of registered scsi hosts */ + ++//pete ++extern pid_t sd_mc_thread_pid; ++//extern DECLARE_COMPLETION(scsi_mc_thread_exited); ++extern struct completion sd_mc_thread_exited; ++// ++ + void + scsi_unregister(struct Scsi_Host * sh){ + struct Scsi_Host * shpnt; +@@ -110,6 +119,15 @@ + + next_scsi_host--; + ++ //pete ++ //printk("+++++ scsi_unregister:next_scsi_host:%d\n", next_scsi_host); ++ if( next_scsi_host == 0){ ++ /* Send a signal to exit the thread. */ ++ kill_proc(sd_mc_thread_pid, SIGTERM, 1); ++ /* If no scsi host left, we wait the thread to exit. */ ++ wait_for_completion(&sd_mc_thread_exited); ++ } ++ // + kfree((char *) sh); + } + +--- R29/drivers/scsi/scsi.c 2004-03-24 19:55:45.000000000 +0000 ++++ R63/drivers/scsi/scsi.c 2005-05-31 10:38:52.000000000 +0100 +@@ -84,7 +84,7 @@ + #endif + + /* +- static const char RCSid[] = "$Header: /home/cvsroot/NSLU2/linux-2.4.x/drivers/scsi/scsi.c,v 1.1.1.1 2004/03/24 19:55:45 sure Exp $"; ++ static const char RCSid[] = "$Header: /home/nas-cvsroot/NSLU2_V2/linux-2.4.x/drivers/scsi/scsi.c,v 1.2 2005/05/31 09:38:52 shearer Exp $"; + */ + + /* +@@ -1991,9 +1991,10 @@ + for (shpnt = scsi_hostlist; shpnt; shpnt = shpnt->next) { + for (SDpnt = shpnt->host_queue; SDpnt; SDpnt = SDpnt->next) + if (SDpnt->host->hostt == tpnt) { +- for (sdtpnt = scsi_devicelist; sdtpnt; sdtpnt = sdtpnt->next) +- if (sdtpnt->attach) +- (*sdtpnt->attach) (SDpnt); ++ for (sdtpnt = scsi_devicelist; sdtpnt; sdtpnt = sdtpnt->next) ++ if (sdtpnt->attach){ ++ (*sdtpnt->attach) (SDpnt); ++ } + if (SDpnt->attached) { + scsi_build_commandblocks(SDpnt); + if (0 == SDpnt->has_cmdblocks) +@@ -2049,7 +2050,7 @@ + char name[10]; /* host_no>=10^9? I don't think so. */ + + /* get the big kernel lock, so we don't race with open() */ +- lock_kernel(); ++ lock_kernel(); + + /* + * First verify that this host adapter is completely free with no pending +--- R29/drivers/scsi/scsi.h 2004-07-07 09:01:24.000000000 +0100 ++++ R63/drivers/scsi/scsi.h 2005-03-31 05:58:07.000000000 +0100 +@@ -575,6 +575,9 @@ + char type; + char scsi_level; + char vendor[8], model[16], rev[4]; ++ //pete ++ char node[6]; ++ // + unsigned char current_tag; /* current tag */ + unsigned char sync_min_period; /* Not less than this period */ + unsigned char sync_max_offset; /* Not greater than this offset */ +--- R29/drivers/scsi/scsi_proc.c 2004-03-24 19:55:45.000000000 +0000 ++++ R63/drivers/scsi/scsi_proc.c 2004-10-28 09:54:56.000000000 +0100 +@@ -263,8 +263,8 @@ + extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE]; + + y = sprintf(buffer + len, +- "Host: scsi%d Channel: %02d Id: %02d Lun: %02d\n Vendor: ", +- scd->host->host_no, scd->channel, scd->id, scd->lun); ++ "Host: scsi%d-%s Channel: %02d Id: %02d Lun: %02d\n Vendor: ", ++ scd->host->host_no, /*pete*/scd->node, scd->channel, scd->id, scd->lun); + for (x = 0; x < 8; x++) { + if (scd->vendor[x] >= 0x20) + y += sprintf(buffer + len + y, "%c", scd->vendor[x]); +--- linux-2.4.22-r29/drivers/scsi/sd.c 2005-11-27 21:08:49.000000000 +0100 ++++ linux-2.4.22/drivers/scsi/sd.c 2005-11-27 21:15:45.000000000 +0100 +@@ -61,6 +61,10 @@ + + #include + ++//pete ++#include ++// ++ + /* + * static const char RCSid[] = "$Header:"; + */ +@@ -81,6 +85,9 @@ + #define N_USED_SD_MAJORS (N_USED_SCSI_DISKS / SCSI_DISKS_PER_MAJOR) + + #define MAX_RETRIES 5 ++//pete ++#define SCSI_SEND_CMND_INTERVAL 5*HZ ++// + + /* + * Time out in seconds for disks and Magneto-opticals (which are slower). +@@ -89,11 +96,16 @@ + #define SD_TIMEOUT (30 * HZ) + #define SD_MOD_TIMEOUT (75 * HZ) + ++// + /* grant */ + //#define GUID_EQUAL(x,y) (x[0]==y[0] && x[1]==y[1] && x[2]==y[2]) + ++//pete ++static int port2_attached; ++pid_t sd_mc_thread_pid; ++DECLARE_COMPLETION(sd_mc_thread_exited); ++// + static Scsi_Disk *rscsi_disks; +-//static Scsi_Disk *rscsi_disks; + static struct gendisk *sd_gendisks; + static int *sd_sizes; + static int *sd_blocksizes; +@@ -104,7 +116,9 @@ + static int fop_revalidate_scsidisk(kdev_t); + + static int sd_init_onedisk(int); +- ++//pete ++static int sd_send_cmnd_one(int); ++// + + static int sd_init(void); + static void sd_finish(void); +@@ -113,6 +127,7 @@ + static void sd_detach(Scsi_Device *); + static int sd_init_command(Scsi_Cmnd *); + ++ + static struct Scsi_Device_Template sd_template = { + name:"disk", + tag:"sd", +@@ -783,6 +798,11 @@ + unsigned int the_result; + int sector_size; + Scsi_Request *SRpnt; ++ ++ //pete ++ char flash[12]="flash_"; ++ char hdd[10]="hdd_"; ++ // + + /* + * Get the name of the disk, in case we need to log it somewhere. +@@ -1053,6 +1073,7 @@ + "%u %d-byte hdwr sectors (%u MB)\n", + nbuff, rscsi_disks[i].capacity, + hard_sector, (sz - sz/625 + 974)/1950); ++ + } + + /* Rescale capacity to 512-byte units */ +@@ -1065,6 +1086,55 @@ + if (sector_size == 256) + rscsi_disks[i].capacity >>= 1; + } ++ // add by super, moified by pete ++ if (rscsi_disks[i].device->removable){ ++ if(0x32 == rscsi_disks[i].device->host->hostt->port){ ++ printk("is removable disk \n"); ++ *IXP425_GPIO_GPOUTR &= 0xfffb; ++ //port2_attached |= 1<<(i-1); ++ remove_proc_entry("flash_sda",NULL); ++ create_proc_read_entry("flash_sda", ++ 0, ++ NULL, ++ NULL, ++ NULL ++ ); ++ }else{ ++ strcat(flash,nbuff); ++ printk("is removable disk \n"); ++ *IXP425_GPIO_GPOUTR &= 0xfff7; ++ port2_attached |= 1<<(i-1); ++ remove_proc_entry(flash,NULL); ++ create_proc_read_entry(flash, ++ 0, ++ NULL, ++ NULL, ++ NULL ++ ); ++ } ++ }else { ++ printk("%x port connect!!!!!\n",rscsi_disks[i].device->host->hostt->port); ++ if(0x32 == rscsi_disks[i].device->host->hostt->port){ ++ *IXP425_GPIO_GPOUTR &= 0xfffb; ++ create_proc_read_entry("hdd_sda", ++ 0, ++ NULL, ++ NULL, ++ NULL ++ ); ++ }else{ ++ *IXP425_GPIO_GPOUTR &= 0xfff7; ++ port2_attached |= 1<<(i-1); ++ strcat(hdd,nbuff); ++ create_proc_read_entry(hdd, ++ 0, ++ NULL, ++ NULL, ++ NULL ++ ); ++ } ++ } ++ //end + + + /* +@@ -1124,6 +1194,140 @@ + return i; + } + ++//pete ++static int sd_send_cmnd_one(int i) ++{ ++ unsigned char cmd[10]; ++ char nbuff[6]; ++ unsigned char *buffer; ++ unsigned int the_result; ++ Scsi_Request *SRpnt; ++ ++ char media[24]; ++ /* ++ * Get the name of the disk, in case we need to log it somewhere. ++ */ ++ sd_devname(i, nbuff); ++ ++ /* ++ * If the device is offline, don't try and read capacity or any ++ * of the other niceties. ++ */ ++ if (rscsi_disks[i].device->online == FALSE) ++ return i; ++ ++ /* ++ * We need to retry the READ_CAPACITY because a UNIT_ATTENTION is ++ * considered a fatal error, and many devices report such an error ++ * just after a scsi bus reset. ++ */ ++ ++ SRpnt = scsi_allocate_request(rscsi_disks[i].device); ++ if (!SRpnt) { ++ printk(KERN_WARNING "(sd_init_onedisk:) Request allocation failure.\n"); ++ return i; ++ } ++ ++ buffer = (unsigned char *) scsi_malloc(512); ++ if (!buffer) { ++ printk(KERN_WARNING "(sd_init_onedisk:) Memory allocation failure.\n"); ++ scsi_release_request(SRpnt); ++ return i; ++ } ++ ++ cmd[0] = TEST_UNIT_READY; /* use this command to test media change */ ++ cmd[1] = (rscsi_disks[i].device->scsi_level <= SCSI_2) ? ++ ((rscsi_disks[i].device->lun << 5) & 0xe0) : 0; ++ memset((void *) &cmd[2], 0, 8); ++ SRpnt->sr_cmd_len = 0; ++ SRpnt->sr_sense_buffer[0] = 0; ++ SRpnt->sr_sense_buffer[2] = 0; ++ SRpnt->sr_data_direction = SCSI_DATA_NONE; ++ ++ scsi_wait_req (SRpnt, (void *) cmd, (void *) buffer, ++ 0/*512*/, SD_TIMEOUT, MAX_RETRIES); ++ ++ the_result = SRpnt->sr_result; ++ ++ sprintf(media, "sd%c_media_not_present", 'a' + i); ++ ++ /* -- code: 0x70, key: 0x2, ASC: 0x3a, ASCQ: 0x0 ++ this indicates Unit not ready: media not present */ ++ if( the_result != 0 ++ && ((driver_byte(the_result) & DRIVER_SENSE) != 0) ++ && SRpnt->sr_sense_buffer[0] == 0x70 ++ && (SRpnt->sr_sense_buffer[2]& 0xf) == NOT_READY ++ && SRpnt->sr_sense_buffer[12] == 0x3A ++ && SRpnt->sr_sense_buffer[13] == 0x0 ) { ++ //printk("sd%c media not present!\n", 'a' + i); ++ remove_proc_entry(media, NULL); ++ create_proc_read_entry(media, ++ 0, ++ NULL, ++ NULL, ++ NULL ++ ); ++ }else if(the_result == 0){ /* need more conditions? */ ++ remove_proc_entry(media, NULL); ++ } ++ ++ scsi_release_request(SRpnt); ++ SRpnt = NULL; ++ ++ scsi_free(buffer, 512); ++ return i; ++} ++ ++static int sd_send_cmnd_thread(void) ++{ ++ int i; ++ ++ siginitsetinv(¤t->blocked, 0); ++ ++ //lock_kernel(); ++ ++ /* ++ * This thread doesn't need any user-level access, ++ * so get rid of all our resources.. ++ */ ++ exit_files(current); ++ current->files = init_task.files; ++ atomic_inc(¤t->files->count); ++ daemonize(); ++ reparent_to_init(); ++ ++ /* avoid getting signals */ ++ spin_lock_irq(¤t->sigmask_lock); ++ flush_signals(current); ++ sigfillset(¤t->blocked); ++ recalc_sigpending(current); ++ spin_unlock_irq(¤t->sigmask_lock); ++ ++ /* set our name for identification purposes */ ++ sprintf(current->comm, "sd-mc-thread"); ++ ++ //unlock_kernel(); ++ ++ do{ ++ /* If all scsi disks are removed, there will be no scsi host, so we should exit this thread. */ ++ if(next_scsi_host == 0) ++ break; ++ ++ for (i = 0; i < sd_template.dev_max; ++i) ++ if ( rscsi_disks[i].device) { ++ sd_send_cmnd_one(i); ++ } ++ ++ /* Now sleep for 5 seconds */ ++ current->state = TASK_INTERRUPTIBLE; ++ schedule_timeout(SCSI_SEND_CMND_INTERVAL); ++ }while(!signal_pending(current)); ++ ++ complete_and_exit(&sd_mc_thread_exited, 0); ++ return 0; ++} ++// ++ + /* + * The sd_init() function looks at all SCSI drives present, determines + * their size, and reads partition table entries for them. +@@ -1298,6 +1502,15 @@ + : 4; /* 4 sector read-ahead */ + } + ++ //pete ++ //printk("-------------------in sd_finish------------------\n"); ++ if(next_scsi_host == 1){ ++ /* We just need *ONE* thread */ ++ sd_mc_thread_pid = kernel_thread(sd_send_cmnd_thread, NULL, CLONE_VM); ++ if(sd_mc_thread_pid < 0) ++ printk("Unable to start sd send command thread\n"); ++ } ++ // + return; + } + +@@ -1323,9 +1536,26 @@ + SDp->attached--; + return 1; + } +- for (dpnt = rscsi_disks, i = 0; i < sd_template.dev_max; i++, dpnt++) +- if ( SDp == dpnt->device || !dpnt->device) /* grant */ +- break; ++ ++ //Pete ++ if(SDp->host->host_no == 0){ ++ dpnt = rscsi_disks; ++ if(dpnt->device){ ++ SDp->attached--; ++ return 1; ++ } ++ i = 0; ++ } ++ else{ ++ //start from rscsi_disk[1]. ++ dpnt = rscsi_disks; ++ dpnt++; ++ i = 1; ++ for (; i < sd_template.dev_max; i++, dpnt++) ++ if (SDp == dpnt->device||!dpnt->device){ ++ break; ++ } ++ } + + if (i >= sd_template.dev_max) { + printk(KERN_WARNING "scsi_devices corrupt (sd)," +@@ -1334,18 +1564,7 @@ + SDp->attached--; + return 1; + } +- /* check different disks by grant */ +- // i = SDp->removable;//super modify +- printk("the host no is %d\n",SDp->host->host_no); +- i = 1 - SDp->host->host_no; +- if ( rscsi_disks[i].device )//&& +- // !GUID_EQUAL( (struct us_data *)rscsi_disks[i].device->host->hostt->proc_dir->guid, +- // (struct us_data *)SDp->host->hostt->proc_dir->guid) ) +- { +- sd_detach( rscsi_disks[i].device ); +- printk("* sd_detach\n"); +- } +- printk("* sd_attach:%d\n",i); ++ + rscsi_disks[i].device = SDp; + rscsi_disks[i].has_part_table = 0; + sd_template.nr_dev++; +@@ -1355,6 +1574,9 @@ + if (SDp->removable) + SD_GENDISK(i).flags[devnum] |= GENHD_FL_REMOVABLE; + sd_devname(i, nbuff); ++ //pete ++ strcpy(SDp->node, nbuff); ++ // + printk("Attached scsi %sdisk %s at scsi%d, channel %d, id %d, lun %d\n", + SDp->removable ? "removable " : "", + nbuff, SDp->host->host_no, SDp->channel, SDp->id, SDp->lun); +@@ -1434,29 +1656,65 @@ + int i, j; + int max_p; + int start; ++ //pete ++ char flash[12]; ++ char hdd[10]; ++ char media[26]; ++ // + + if (rscsi_disks == NULL) + return; + ++ + for (dpnt = rscsi_disks, i = 0; i < sd_template.dev_max; i++, dpnt++) + if (dpnt->device == SDp) { ++ ++ #if 1 ++ //pete ++ sprintf(media, "sd%c_media_not_present", 'a' + i); ++ ++ switch(SDp->host->hostt->port){ ++ case 0x31: ++ port2_attached ^= 1<<(i-1); ++ if(port2_attached < 0) ++ port2_attached = 0; ++ if(port2_attached == 0) ++ *IXP425_GPIO_GPOUTR |= 0x8; ++ if(SDp->removable == 1){ ++ sprintf(flash, "flash_sd%c", 'a' + i); ++ remove_proc_entry(flash, NULL); ++ remove_proc_entry(media, NULL); ++ }else{ ++ sprintf(hdd, "hdd_sd%c", 'a' + i); ++ remove_proc_entry(hdd,NULL); ++ remove_proc_entry(media, NULL); ++ } ++ break; ++ case 0x32: ++ *IXP425_GPIO_GPOUTR |= 0x4; ++ if(SDp->removable == 1){ ++ remove_proc_entry("flash_sda",NULL); ++ } ++ else ++ remove_proc_entry("hdd_sda",NULL); ++ break; ++ default: ++ break; ++ } ++ #endif ++ // + + /* If we are disconnecting a disk driver, sync and invalidate + * everything */ + sdgd = &SD_GENDISK(i); + max_p = sd_gendisk.max_p; + start = i << sd_gendisk.minor_shift; +-printk("max_p is %d ;start is %d\n",max_p,start); +- + for (j = max_p - 1; j >= 0; j--) { + int index = start + j; +- // printk("invalidate_device index = %d\n",index); +- invalidate_device(MKDEV_SD_PARTITION(index), 1); ++ invalidate_device(MKDEV_SD_PARTITION(index), 0); + sdgd->part[SD_MINOR_NUMBER(index)].start_sect = 0; + sdgd->part[SD_MINOR_NUMBER(index)].nr_sects = 0; + sd_sizes[index] = 0; +- // printk("MKDEV_SD_PARTITION ok\n"); +- + } + devfs_register_partitions (sdgd, + SD_MINOR_NUMBER (start), 1); +--- R29/drivers/usb/host/ehci-q.c 2004-07-07 08:31:43.000000000 +0100 ++++ R63/drivers/usb/host/ehci-q.c 2005-02-03 04:59:48.000000000 +0000 +@@ -39,6 +39,22 @@ + */ + + /*-------------------------------------------------------------------------*/ ++ ++//pete ++void ehci_urb_dma_sync(struct usb_hcd *hcd, struct urb *urb) ++{ ++ if (urb->setup_dma) ++ pci_dma_sync_single(hcd->pdev, urb->setup_dma, ++ sizeof(struct usb_ctrlrequest), ++ PCI_DMA_TODEVICE); ++ if (urb->transfer_buffer_length != 0) ++ pci_dma_sync_single(hcd->pdev, urb->transfer_dma, ++ urb->transfer_buffer_length, ++ usb_pipein(urb->pipe) ++ ? PCI_DMA_FROMDEVICE ++ : PCI_DMA_TODEVICE); ++} ++// + + /* fill a qtd, returning how much of the buffer we were able to queue up */ + +@@ -205,7 +221,16 @@ + qh_put (ehci, qh); + } + ++ ++ + spin_lock (&urb->lock); ++ ++//pete: This fix the 2.0hub + 1.1 udisks bug ++ /* only control transfer makes trouble */ ++ if (usb_pipecontrol (urb->pipe)){ ++ ehci_urb_dma_sync(&ehci->hcd, urb); ++ } ++ + urb->hcpriv = 0; + switch (urb->status) { + case -EINPROGRESS: /* success */ +@@ -799,6 +824,10 @@ + { + struct ehci_qh *qh = 0; + ++ //pete ++ //printk("in qh_append_tds\n"); ++ //show_bytes((unsigned char *)&urb->dev->descriptor, 18); ++ + qh = (struct ehci_qh *) *ptr; + if (unlikely (qh == 0)) { + /* can't sleep here, we have ehci->lock... */ +@@ -903,6 +932,9 @@ + dummy->hw_token = token; + + urb->hcpriv = qh_get (qh); ++ //pete ++ //show_bytes((unsigned char *)&urb->dev->descriptor, 18); ++ //show_bytes((unsigned char *)&dma, 18); + } + } + return qh; +--- R29/drivers/usb/host/usb-uhci.c 2004-03-24 20:42:22.000000000 +0000 ++++ R63/drivers/usb/host/usb-uhci.c 2004-11-11 09:38:55.000000000 +0000 +@@ -16,7 +16,7 @@ + * (C) Copyright 1999 Randy Dunlap + * (C) Copyright 1999 Gregory P. Smith + * +- * $Id: usb-uhci.c,v 1.1 2004/03/24 20:42:22 sure Exp $ ++ * $Id: usb-uhci.c,v 1.3 2004/10/19 03:36:08 pete Exp $ + */ + + #include +@@ -53,7 +53,7 @@ + /* This enables an extra UHCI slab for memory debugging */ + #define DEBUG_SLAB + +-#define VERSTR "$Revision: 1.1 $ time " __TIME__ " " __DATE__ ++#define VERSTR "$Revision: 1.3 $ time " __TIME__ " " __DATE__ + + #include + #include "usb-uhci.h" +@@ -2330,6 +2330,10 @@ + status stage is completed + */ + ++ //Pete ++ //uhci_urb_dma_sync(s, urb, urb->hcpriv); ++ // ++ + if (urb_priv->flags && + ((qh->hw.qh.element == cpu_to_le32(UHCI_PTR_TERM)) || !is_td_active(desc))) + goto transfer_finished; +@@ -2364,6 +2368,10 @@ + else if ((le32_to_cpu(desc->hw.td.info) & 0xff) != USB_PID_SETUP) + urb->actual_length += actual_length; + ++ //Pete ++ uhci_urb_dma_sync(s, urb, urb->hcpriv); ++ // ++ + // got less data than requested + if ( (actual_length < maxlength)) { + if (urb->transfer_flags & USB_DISABLE_SPD) { +--- R29/drivers/usb/hub.c 2004-03-24 19:55:48.000000000 +0000 ++++ R63/drivers/usb/hub.c 2005-06-02 07:31:32.000000000 +0100 +@@ -726,7 +726,6 @@ + break; + } + +- hub->children[port] = dev; + + /* Reset the device */ + if (usb_hub_port_reset(hub, port, dev, delay)) { +@@ -776,8 +775,11 @@ + } + + /* Run it through the hoops (find a driver, etc) */ +- if (!usb_new_device(dev)) ++ if (!usb_new_device(dev)){ ++ //pete ++ hub->children[port] = dev; + goto done; ++ } + + /* Free the configuration if there was an error */ + usb_free_dev(dev); +@@ -896,9 +898,9 @@ + usb_clear_port_feature(dev, i + 1, USB_PORT_FEAT_C_RESET); + } + // if (portchange&&(!list_empty(&hub_event_list.next))){ +- if (portchange){ +- break;//super +- } ++// if (portchange){ ++// break;//super ++// } + } /* end for i */ + + /* deal with hub status changes */ +--- linux-2.4.22-r29/drivers/usb/storage/transport.c 2005-11-27 21:09:04.000000000 +0100 ++++ linux-2.4.22/drivers/usb/storage/transport.c 2005-11-28 15:56:40.000000000 +0100 +@@ -1,6 +1,6 @@ + /* Driver for USB Mass Storage compliant devices + * +- * $Id: transport.c,v 1.1 2004/03/24 20:43:17 sure Exp $ ++ * $Id: transport.c,v 1.2 2004/09/29 03:56:50 super Exp $ + * + * Current development and maintenance by: + * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) +@@ -1244,6 +1244,8 @@ + goto out; + } + ++ udelay(100); /* For GL811E Chip */ ++ + /* if the command transfered well, then we go to the data stage */ + if (result == 0) { + +--- linux-2.4.22-r29/drivers/usb/storage/usb.c 2005-11-27 21:09:04.000000000 +0100 ++++ linux-2.4.22/drivers/usb/storage/usb.c 2005-11-28 16:10:25.000000000 +0100 +@@ -1,6 +1,6 @@ + /* Driver for USB Mass Storage compliant devices + * +- * $Id: usb.c,v 1.2 2004/08/30 06:54:48 sure Exp $ ++ * $Id: usb.c,v 1.2 2004/10/08 03:41:34 pete Exp $ + * + * Current development and maintenance by: + * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) +@@ -561,7 +561,7 @@ + GUID(guid); /* Global Unique Identifier */ + unsigned int flags; + struct us_unusual_dev *unusual_dev; +- struct us_data *ss = NULL, *pre_ss, *tmp /* grant */; ++ struct us_data *ss = NULL; /* grant */; + #ifdef CONFIG_USB_STORAGE_SDDR09 + int result; + #endif +@@ -705,23 +705,11 @@ + */ + ss = us_list; + /* modified to free unusable node by grant */ +- pre_ss = us_list; ++ + while ((ss != NULL) && + ((ss->pusb_dev) || !GUID_EQUAL(guid, ss->guid))) +- { +- pre_ss = ss; + ss = ss->next; +- } +- /* end mod */ +-//super add +-#if 0 +- if (ss != NULL){ +- scsi_unregister_module(MODULE_SCSI_HA, &(ss->htmplt)); +- free_us_data( pre_ss, ss ); +- usb_dec_dev_use(dev); +- } +-#endif +-// ++ + if (ss != NULL) { + /* Existing device -- re-connect */ + US_DEBUGP("Found existing GUID " GUID_FORMAT "\n", +@@ -747,95 +735,6 @@ + USB_ENDPOINT_NUMBER_MASK; + ss->ep_int = ep_int; + +- /* grant 01/30 */ +-#if 0 +- if ( 0x32 != dev->bus->bus_name[6] ) +- { +- dev->devpath[0] = dev->bus->bus_name[6] + 1; +- } +- /* restrict device on certain port */ +- if ( ss->htmplt.removable ^ (USB_DEVPATH_2 == dev->devpath[0]) ) +- { +- printk("* (old)%s disk not allowed on port:%s\n", ss->htmplt.removable ? "flash" : "hard", dev->devpath); +- usb_dec_dev_use(dev); +- scsi_unregister_module(MODULE_SCSI_HA, &(ss->htmplt)); +- free_us_data( pre_ss, ss ); +- return NULL; +- } +- if (ss->htmplt.removable){ +- // add by super +- remove_proc_entry("usb_conn",NULL); +- *IXP425_GPIO_GPOUTR &= 0xfffb; +- create_proc_read_entry("usb_conn", +- 0, +- NULL, +- NULL, +- NULL +- ); +- }else{ +- remove_proc_entry("hd_conn",NULL); +- *IXP425_GPIO_GPOUTR &= 0xfff7; +- create_proc_read_entry("hd_conn", +- 0, +- NULL, +- NULL, +- NULL +- ); +- } +- printk("rscsi_disk capacity is %d@@@@@@@@@@@@@@@@\n",ss->host->host_queue->sector_size); +- if(ss->host->host_queue->sector_size<40000000){ +- ss->htmplt.removable = 1; +- } +-#endif +-#if 0 +- /* restrict device on certain port */ +- if ( ss->htmplt.removable && (USB_DEVPATH_1 == dev->devpath[0])) +- if ( ss->htmplt.removable ^ (USB_DEVPATH_2 == dev->devpath[0]) ) +- { +- create_proc_read_entry("usb_err", +- 0, +- NULL, +- NULL, +- NULL +- ); +- printk("* (old)%s disk not allowed on port:%s\n", ss->htmplt.removable ? "flash" : "hard", dev->devpath); +- usb_dec_dev_use(dev); +- scsi_unregister_module(MODULE_SCSI_HA, &(ss->htmplt)); +- free_us_data( pre_ss, ss ); +- return NULL; +- } +-#endif +- if (ss->htmplt.removable && (USB_DEVPATH_2 == dev->devpath[0])){ +- printk("is removable disk \n"); +- *IXP425_GPIO_GPOUTR &= 0xfffb; +- create_proc_read_entry("usb_conn", +- 0, +- NULL, +- NULL, +- NULL +- ); +- }else { +- printk("%x port connect\n",dev->devpath[0]); +- if(0x31 == dev->devpath[0]){ +- *IXP425_GPIO_GPOUTR &= 0xfff7; +- create_proc_read_entry("hd_conn", +- 0, +- NULL, +- NULL, +- NULL +- ); +- }else{ +- *IXP425_GPIO_GPOUTR &= 0xfffb; +- create_proc_read_entry("hd2_conn", +- 0, +- NULL, +- NULL, +- NULL +- ); +- } +- } +- //end +- + /* allocate an IRQ callback if one is needed */ + if ((ss->protocol == US_PR_CBI) && usb_stor_allocate_irq(ss)) { + usb_dec_dev_use(dev); +@@ -857,6 +756,23 @@ + up(&(ss->dev_semaphore)); + + } else { ++#if 0 ++ //grant,pete ++ if ( ss->htmplt.removable ^ (USB_DEVPATH_2 == dev->devpath[0]) ) ++ { ++ create_proc_read_entry("usb_err", ++ 0, ++ NULL, ++ NULL, ++ NULL ++ ); ++ printk("* (old)%s disk not allowed on port:%s\n", ss->htmplt.removable ? "flash" : "hard", dev->devpath); ++ usb_dec_dev_use(dev); ++ scsi_unregister_module(MODULE_SCSI_HA, &(ss->htmplt)); ++ return NULL; ++ } ++ // ++#endif + /* New device -- allocate memory and initialize */ + US_DEBUGP("New GUID " GUID_FORMAT "\n", GUID_ARGS(guid)); + +@@ -1103,11 +1019,7 @@ + sizeof(usb_stor_host_template)); + + /* Grab the next host number */ +- //ss->host_number = my_host_number++; +- +- /* fix device name & host number by grant */ +-// ss->host_number = dev->devpath[0] - USB_DEVPATH_1 ; +- ss->host_number = USB_DEVPATH_2 - dev->devpath[0]; ++ ss->host_number = my_host_number++; + + /* We abuse this pointer so we can pass the ss pointer to + * the host controller thread in us_detect. But how else are +@@ -1128,7 +1040,6 @@ + * the device if it needs initialization */ + if (unusual_dev && unusual_dev->initFunction) + unusual_dev->initFunction(ss); +- printk("before kernel thread \n"); + /* start up our control thread */ + ss->pid = kernel_thread(usb_stor_control_thread, ss, + CLONE_VM); +@@ -1146,60 +1057,11 @@ + + /* now register - our detect function will be called */ + ss->htmplt.module = THIS_MODULE; +- /*debug by grant*/ +-// printk("!! 1\n"); + +- /* grant 01/30 */ +- // printk ("* bus = %c\n", dev->bus->bus_name[6]); +- #if 0 +- if ( 0x32 != dev->bus->bus_name[6] ) +- { +- dev->devpath[0] = dev->bus->bus_name[6] + 1; +- // dev->devpath[0] = 0x32; +- } +-// printk("devpath = %c\n",dev->devpath[0]); +-#endif + ss->htmplt.port = dev->devpath[0]; + +- tmp = us_list; +- pre_ss = tmp; +- while ( NULL != tmp ) +- { +- /* free old device node by grant */ +- if( (tmp->htmplt.port == ss->htmplt.port) && (!GUID_EQUAL(tmp->guid, ss->guid)) ) +- { +- scsi_unregister_module(MODULE_SCSI_HA, &(tmp->htmplt)); +-// printk("* (2)scsi_unregister_module\n"); +- free_us_data( pre_ss, tmp ); +- break; +- } +- pre_ss = tmp; +- tmp = tmp->next; +- } +- + scsi_register_module(MODULE_SCSI_HA, &(ss->htmplt)); + +- /* check device port grant */ +- if ( 1 == ss->host->porttype ) +- { +-// printk("* (usb)scsi_unregister_module\n"); +- scsi_unregister_module(MODULE_SCSI_HA, &(ss->htmplt)); +- kfree(ss->current_urb); +- kfree(ss); +- usb_dec_dev_use(dev); +- return NULL; +- } +- +- /* debug grant */ +- i = 0; +- tmp = us_list; +- while ( NULL != tmp ) +- { +- i ++; +- tmp = tmp->next; +- } +-// printk("* (usb)scsi_register_module okay! us_data:%d\n", i ); +- + /* lock access to the data structures */ + down(&us_list_semaphore); + +@@ -1248,34 +1110,18 @@ + } + + +- + /* Handle a disconnect event from the USB core */ + static void storage_disconnect(struct usb_device *dev, void *ptr) + { + struct us_data *ss = ptr; +-// struct us_data *pre_ss; ++ struct us_data *tmp,*pre_ss; + int result; +-//super add +- char serial[USB_STOR_STRING_LEN]; /* serial number */ +-// GUID(guid); /* Global Unique Identifier */ +-//super modify +- switch(dev->devpath[0]){ +- case 0x31: +- *IXP425_GPIO_GPOUTR |= 0x8; +- remove_proc_entry("hd_conn",NULL); +- break; +- case 0x32: +- *IXP425_GPIO_GPOUTR |= 0x4; +- remove_proc_entry("usb_conn",NULL); +- remove_proc_entry("hd2_conn",NULL); +- break; +- default: +- break; +- } +-//end ++ //Pete ++ int i; ++ // ++ + US_DEBUGP("storage_disconnect() called\n"); + +- memset(serial,0,USB_STOR_STRING_LEN); + /* this is the odd case -- we disconnected but weren't using it */ + if (!ss) { + US_DEBUGP("-- device was not in use\n"); +@@ -1285,6 +1131,35 @@ + /* lock access to the device data structure */ + down(&(ss->dev_semaphore)); + ++ tmp = us_list; ++ pre_ss = tmp; ++ i = 0; ++ ++ while ( tmp != NULL ) ++ { ++ if( (tmp->htmplt.port == ss->htmplt.port) && (GUID_EQUAL(tmp->guid, ss->guid)) ) ++ { ++ scsi_unregister_module(MODULE_SCSI_HA, &(tmp->htmplt)); ++ if( ss == us_list ) ++ { ++ us_list = ss->next; ++ } ++ else if( ss->next == NULL ) ++ { ++ pre_ss->next = NULL; ++ } ++ else ++ { ++ pre_ss->next = ss->next; ++ } ++ ++ break; ++ } ++ i++; ++ pre_ss = tmp; ++ tmp = tmp->next; ++ } ++ + if(ss->extra && ss->extra_destructor){ + ss->extra_destructor(ss->extra); + } +--- R29/drivers/usb/usb.c 2004-07-07 08:31:44.000000000 +0100 ++++ R63/drivers/usb/usb.c 2005-06-29 06:26:23.000000000 +0100 +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + + #include + #ifdef CONFIG_USB_DEBUG +@@ -1014,12 +1015,11 @@ + if (atomic_dec_and_test(&dev->refcnt)) { + dev->bus->op->deallocate(dev); + usb_destroy_configuration(dev); +- + usb_bus_put(dev->bus); +- +- ++ + if(dev) + kfree(dev); ++ dev = NULL; + } + } + +@@ -1749,6 +1749,7 @@ + /* + * Something got disconnected. Get rid of it, and all of its children. + */ ++static int dev_num=0; + void usb_disconnect(struct usb_device **pdev) + { + struct usb_device * dev = *pdev; +@@ -1758,35 +1759,9 @@ + return; + + *pdev = NULL; +- ++ + info("USB disconnect on device %s-%s address %d", + dev->bus->bus_name, dev->devpath, dev->devnum); +-#if 0 +- // add by super +- switch(dev->devpath[0]){ +- case 0x31: +- *IXP425_GPIO_GPOUTR |= 0x8; +- remove_proc_entry("hd_conn",NULL); +- break; +- case 0x32: +- *IXP425_GPIO_GPOUTR |= 0x4; +- remove_proc_entry("usb_conn",NULL); +- remove_proc_entry("hd2_conn",NULL); +- break; +- default: +- break; +- } +- if (*dev->devpath==0x31){ +- *IXP425_GPIO_GPOUTR |= 0x8; +- remove_proc_entry("hd_conn",NULL); +- }else{ +- *IXP425_GPIO_GPOUTR |= 0x4; +- remove_proc_entry("usb_conn",NULL); +- } +-#endif +- if (*dev->devpath==0x31) +- remove_proc_entry("usb_err",NULL); +- //end + if (dev->actconfig) { + for (i = 0; i < dev->actconfig->bNumInterfaces; i++) { + struct usb_interface *interface = &dev->actconfig->interface[i]; +@@ -1808,7 +1783,7 @@ + if (*child) + usb_disconnect(child); + } +- ++ + /* Let policy agent unload modules etc */ + call_policy ("remove", dev); + +@@ -1817,7 +1792,7 @@ + clear_bit(dev->devnum, &dev->bus->devmap.devicemap); + usbdevfs_remove_device(dev); + } +- ++ + /* Free up the device itself */ + usb_free_dev(dev); + } +@@ -2292,7 +2267,7 @@ + + wait_ms(10); /* Let the SET_ADDRESS settle */ + +-//super modify ++ //Pete + err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, 8); + if (err < 8) { + if (err < 0) +@@ -2303,10 +2278,13 @@ + dev->devnum = -1; + return 1; + } +-// ++ ++ //pete, reserve this printk here! ++ printk("Device descriptor:%d bytes received.\n",err); ++ + dev->epmaxpacketin [0] = dev->descriptor.bMaxPacketSize0; + dev->epmaxpacketout[0] = dev->descriptor.bMaxPacketSize0; +- ++ + err = usb_get_device_descriptor(dev); + if (err < (signed)sizeof(dev->descriptor)) { + if (err < 0) +@@ -2314,12 +2292,14 @@ + else + err("USB device descriptor short read (expected %Zi, got %i)", + sizeof(dev->descriptor), err); +- + clear_bit(dev->devnum, &dev->bus->devmap.devicemap); + dev->devnum = -1; + return 1; + } + ++ //pete, reserve this printk here! ++ printk("Device descriptor:%d bytes received.\n",err); ++ + err = usb_get_configuration(dev); + if (err < 0) { + err("unable to get device %d configuration (error=%d)", +--- R29/fs/fat/dir.c 2004-03-24 19:56:01.000000000 +0000 ++++ R63/fs/fat/dir.c 2005-03-31 04:30:53.000000000 +0100 +@@ -198,11 +198,11 @@ + int uni_xlate = MSDOS_SB(sb)->options.unicode_xlate; + int utf8 = MSDOS_SB(sb)->options.utf8; + unsigned short opt_shortname = MSDOS_SB(sb)->options.shortname; +- int ino, chl, i, j, last_u, res = 0; +- loff_t cpos = 0; ++ int chl, i, j, last_u, res = 0; ++ loff_t i_pos, cpos = 0; + + while(1) { +- if (fat_get_entry(inode,&cpos,&bh,&de,&ino) == -1) ++ if (fat_get_entry(inode,&cpos,&bh,&de,&i_pos) == -1) + goto EODir; + parse_record: + long_slots = 0; +@@ -253,7 +253,7 @@ + if (ds->id & 0x40) { + unicode[offset + 13] = 0; + } +- if (fat_get_entry(inode,&cpos,&bh,&de,&ino)<0) ++ if (fat_get_entry(inode,&cpos,&bh,&de,&i_pos)<0) + goto EODir; + if (slot == 0) + break; +@@ -368,8 +368,9 @@ + int utf8 = MSDOS_SB(sb)->options.utf8; + int nocase = MSDOS_SB(sb)->options.nocase; + unsigned short opt_shortname = MSDOS_SB(sb)->options.shortname; +- int ino, inum, chi, chl, i, i2, j, last, last_u, dotoffset = 0; +- loff_t cpos; ++ unsigned long inum; ++ int chi, chl, i, i2, j, last, last_u, dotoffset = 0; ++ loff_t i_pos, cpos; + + cpos = filp->f_pos; + /* Fake . and .. for the root directory. */ +@@ -392,7 +393,7 @@ + bh = NULL; + GetNew: + long_slots = 0; +- if (fat_get_entry(inode,&cpos,&bh,&de,&ino) == -1) ++ if (fat_get_entry(inode,&cpos,&bh,&de,&i_pos) == -1) + goto EODir; + /* Check for long filename entry */ + if (isvfat) { +@@ -449,7 +450,7 @@ + if (ds->id & 0x40) { + unicode[offset + 13] = 0; + } +- if (fat_get_entry(inode,&cpos,&bh,&de,&ino) == -1) ++ if (fat_get_entry(inode,&cpos,&bh,&de,&i_pos) == -1) + goto EODir; + if (slot == 0) + break; +@@ -541,7 +542,7 @@ + /* inum = fat_parent_ino(inode,0); */ + inum = filp->f_dentry->d_parent->d_inode->i_ino; + } else { +- struct inode *tmp = fat_iget(sb, ino); ++ struct inode *tmp = fat_iget(sb, i_pos); + if (tmp) { + inum = tmp->i_ino; + iput(tmp); +@@ -690,14 +691,14 @@ + /***** See if directory is empty */ + int fat_dir_empty(struct inode *dir) + { +- loff_t pos; ++ loff_t pos, i_pos; + struct buffer_head *bh; + struct msdos_dir_entry *de; +- int ino,result = 0; ++ int result = 0; + + pos = 0; + bh = NULL; +- while (fat_get_entry(dir,&pos,&bh,&de,&ino) > -1) { ++ while (fat_get_entry(dir,&pos,&bh,&de,&i_pos) > -1) { + /* Ignore vfat longname entries */ + if (de->attr == ATTR_EXT) + continue; +@@ -717,7 +718,7 @@ + /* This assumes that size of cluster is above the 32*slots */ + + int fat_add_entries(struct inode *dir,int slots, struct buffer_head **bh, +- struct msdos_dir_entry **de, int *ino) ++ struct msdos_dir_entry **de, loff_t *i_pos) + { + struct super_block *sb = dir->i_sb; + loff_t offset, curr; +@@ -727,7 +728,7 @@ + offset = curr = 0; + *bh = NULL; + row = 0; +- while (fat_get_entry(dir,&curr,bh,de,ino) > -1) { ++ while (fat_get_entry(dir,&curr,bh,de,i_pos) > -1) { + if (IS_FREE((*de)->name)) { + if (++row == slots) + return offset; +@@ -742,7 +743,7 @@ + if (!new_bh) + return -ENOSPC; + fat_brelse(sb, new_bh); +- do fat_get_entry(dir,&curr,bh,de,ino); while (++row> FAT_HASH_BITS) + (tmp >> FAT_HASH_BITS * 2); + return tmp & FAT_HASH_MASK; + } + +-void fat_attach(struct inode *inode, int i_pos) ++void fat_attach(struct inode *inode, loff_t i_pos) + { + spin_lock(&fat_inode_lock); +- MSDOS_I(inode)->i_location = i_pos; ++ MSDOS_I(inode)->i_pos = i_pos; + list_add(&MSDOS_I(inode)->i_fat_hash, + fat_inode_hashtable + fat_hash(inode->i_sb, i_pos)); + spin_unlock(&fat_inode_lock); +@@ -102,13 +102,13 @@ + void fat_detach(struct inode *inode) + { + spin_lock(&fat_inode_lock); +- MSDOS_I(inode)->i_location = 0; ++ MSDOS_I(inode)->i_pos = 0; + list_del(&MSDOS_I(inode)->i_fat_hash); + INIT_LIST_HEAD(&MSDOS_I(inode)->i_fat_hash); + spin_unlock(&fat_inode_lock); + } + +-struct inode *fat_iget(struct super_block *sb, int i_pos) ++struct inode *fat_iget(struct super_block *sb, loff_t i_pos) + { + struct list_head *p = fat_inode_hashtable + fat_hash(sb, i_pos); + struct list_head *walk; +@@ -120,7 +120,7 @@ + i = list_entry(walk, struct msdos_inode_info, i_fat_hash); + if (i->i_fat_inode->i_sb != sb) + continue; +- if (i->i_location != i_pos) ++ if (i->i_pos != i_pos) + continue; + inode = igrab(i->i_fat_inode); + if (inode) +@@ -133,11 +133,11 @@ + static void fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de); + + struct inode *fat_build_inode(struct super_block *sb, +- struct msdos_dir_entry *de, int ino, int *res) ++ struct msdos_dir_entry *de, loff_t i_pos, int *res) + { + struct inode *inode; + *res = 0; +- inode = fat_iget(sb, ino); ++ inode = fat_iget(sb, i_pos); + if (inode) + goto out; + inode = new_inode(sb); +@@ -147,7 +147,7 @@ + *res = 0; + inode->i_ino = iunique(sb, MSDOS_ROOT_INO); + fat_fill_inode(inode, de); +- fat_attach(inode, ino); ++ fat_attach(inode, i_pos); + insert_inode_hash(inode); + out: + return inode; +@@ -379,7 +379,7 @@ + int nr; + + INIT_LIST_HEAD(&MSDOS_I(inode)->i_fat_hash); +- MSDOS_I(inode)->i_location = 0; ++ MSDOS_I(inode)->i_pos = 0; + MSDOS_I(inode)->i_fat_inode = inode; + inode->i_uid = sbi->options.fs_uid; + inode->i_gid = sbi->options.fs_gid; +@@ -406,7 +406,7 @@ + } + inode->i_blksize = 1 << sbi->cluster_bits; + inode->i_blocks = ((inode->i_size + inode->i_blksize - 1) +- & ~(inode->i_blksize - 1)) >> 9; ++ & ~((loff_t)inode->i_blksize - 1)) >> 9; + MSDOS_I(inode)->i_logstart = 0; + MSDOS_I(inode)->mmu_private = inode->i_size; + +@@ -443,19 +443,25 @@ + return ERR_PTR(-ESTALE); + + inode = iget(sb, fh[0]); +- if (!inode || is_bad_inode(inode) || +- inode->i_generation != fh[1]) { +- if (inode) iput(inode); ++ if (!inode || is_bad_inode(inode) || inode->i_generation != fh[1]) { ++ if (inode) ++ iput(inode); + inode = NULL; + } + if (!inode) { +- /* try 2 - see if i_location is in F-d-c ++ loff_t i_pos; ++ int i_logstart = fh[3] & 0x0fffffff; ++ ++ i_pos = (loff_t)fh[2] << 8; ++ i_pos |= ((fh[3] >> 24) & 0xf0) | (fh[4] >> 28); ++ ++ /* try 2 - see if i_pos is in F-d-c + * require i_logstart to be the same + * Will fail if you truncate and then re-write + */ + +- inode = fat_iget(sb, fh[2]); +- if (inode && MSDOS_I(inode)->i_logstart != fh[3]) { ++ inode = fat_iget(sb, i_pos); ++ if (inode && MSDOS_I(inode)->i_logstart != i_logstart) { + iput(inode); + inode = NULL; + } +@@ -505,23 +511,26 @@ + result->d_op = sb->s_root->d_op; + result->d_flags |= DCACHE_NFSD_DISCONNECTED; + return result; +- +- + } + + int fat_dentry_to_fh(struct dentry *de, __u32 *fh, int *lenp, int needparent) + { + int len = *lenp; + struct inode *inode = de->d_inode; ++ u32 ipos_h, ipos_m, ipos_l; + + if (len < 5) + return 255; /* no room */ ++ ++ ipos_h = MSDOS_I(inode)->i_pos >> 8; ++ ipos_m = (MSDOS_I(inode)->i_pos & 0xf0) << 24; ++ ipos_l = (MSDOS_I(inode)->i_pos & 0x0f) << 28; + *lenp = 5; + fh[0] = inode->i_ino; + fh[1] = inode->i_generation; +- fh[2] = MSDOS_I(inode)->i_location; +- fh[3] = MSDOS_I(inode)->i_logstart; +- fh[4] = MSDOS_I(de->d_parent->d_inode)->i_logstart; ++ fh[2] = ipos_h; ++ fh[3] = ipos_m | MSDOS_I(inode)->i_logstart; ++ fh[4] = ipos_l | MSDOS_I(de->d_parent->d_inode)->i_logstart; + return 3; + } + +@@ -636,7 +645,7 @@ + + sbi->cluster_bits = ffs(logical_sector_size * sbi->cluster_size) - 1; + sbi->fats = b->fats; +- sbi->fat_start = CF_LE_W(b->reserved); ++ sbi->fat_start = CF_LE_W(b->reserved); + sbi->prev_free = 0; + if (!b->fat_length && b->fat32_length) { + struct fat_boot_fsinfo *fsinfo; +@@ -647,7 +656,8 @@ + fat32 = 1; + sbi->fat_length = CF_LE_L(b->fat32_length); + sbi->root_cluster = CF_LE_L(b->root_cluster); +- ++ sb->s_maxbytes = 0xffffffff; ++ + sbi->fsinfo_sector = CF_LE_W(b->info_sector); + /* MC - if info_sector is 0, don't multiply by 0 */ + if (sbi->fsinfo_sector == 0) +@@ -891,7 +901,7 @@ + int nr; + + INIT_LIST_HEAD(&MSDOS_I(inode)->i_fat_hash); +- MSDOS_I(inode)->i_location = 0; ++ MSDOS_I(inode)->i_pos = 0; + MSDOS_I(inode)->i_fat_inode = inode; + inode->i_uid = sbi->options.fs_uid; + inode->i_gid = sbi->options.fs_gid; +@@ -906,10 +916,9 @@ + inode->i_fop = &fat_dir_operations; + + MSDOS_I(inode)->i_start = CF_LE_W(de->start); +- if (sbi->fat_bits == 32) { +- MSDOS_I(inode)->i_start |= +- (CF_LE_W(de->starthi) << 16); +- } ++ if (sbi->fat_bits == 32) ++ MSDOS_I(inode)->i_start |= (CF_LE_W(de->starthi) << 16); ++ + MSDOS_I(inode)->i_logstart = MSDOS_I(inode)->i_start; + inode->i_nlink = fat_subdirs(inode); + /* includes .., compensating for "self" */ +@@ -956,7 +965,7 @@ + /* this is as close to the truth as we can get ... */ + inode->i_blksize = 1 << sbi->cluster_bits; + inode->i_blocks = ((inode->i_size + inode->i_blksize - 1) +- & ~(inode->i_blksize - 1)) >> 9; ++ & ~((loff_t)inode->i_blksize - 1)) >> 9; + inode->i_mtime = inode->i_atime = + date_dos2unix(CF_LE_W(de->time),CF_LE_W(de->date)); + inode->i_ctime = +@@ -971,22 +980,22 @@ + struct super_block *sb = inode->i_sb; + struct buffer_head *bh; + struct msdos_dir_entry *raw_entry; +- unsigned int i_pos; ++ loff_t i_pos; + + retry: +- i_pos = MSDOS_I(inode)->i_location; ++ i_pos = MSDOS_I(inode)->i_pos; + if (inode->i_ino == MSDOS_ROOT_INO || !i_pos) { + return; + } + lock_kernel(); + if (!(bh = fat_bread(sb, i_pos >> MSDOS_SB(sb)->dir_per_block_bits))) { +- printk("dev = %s, ino = %d\n", kdevname(inode->i_dev), i_pos); ++ printk("dev = %s, i_pos = %llu\n", kdevname(inode->i_dev), i_pos); + fat_fs_panic(sb, "msdos_write_inode: unable to read i-node block"); + unlock_kernel(); + return; + } + spin_lock(&fat_inode_lock); +- if (i_pos != MSDOS_I(inode)->i_location) { ++ if (i_pos != MSDOS_I(inode)->i_pos) { + spin_unlock(&fat_inode_lock); + fat_brelse(sb, bh); + unlock_kernel(); +--- R29/fs/fat/misc.c 2004-03-24 19:56:01.000000000 +0000 ++++ R63/fs/fat/misc.c 2005-03-31 04:20:35.000000000 +0100 +@@ -316,11 +316,12 @@ + */ + + int fat__get_entry(struct inode *dir, loff_t *pos,struct buffer_head **bh, +- struct msdos_dir_entry **de, int *ino) ++ struct msdos_dir_entry **de, loff_t *i_pos) + { + struct super_block *sb = dir->i_sb; + struct msdos_sb_info *sbi = MSDOS_SB(sb); +- int sector, offset; ++ int sector; ++ loff_t offset; + + while (1) { + offset = *pos; +@@ -343,7 +344,7 @@ + + offset &= sb->s_blocksize - 1; + *de = (struct msdos_dir_entry *) ((*bh)->b_data + offset); +- *ino = (sector << sbi->dir_per_block_bits) + (offset >> MSDOS_DIR_BITS); ++ *i_pos = ((loff_t)sector << sbi->dir_per_block_bits) + (offset >> MSDOS_DIR_BITS); + + return 0; + } +@@ -383,7 +384,7 @@ + done = !IS_FREE(data[entry].name) \ + && ( \ + ( \ +- (MSDOS_SB(sb)->fat_bits != 32) ? 0 : (CF_LE_W(data[entry].starthi) << 16) \ ++ (sbi->fat_bits != 32) ? 0 : (CF_LE_W(data[entry].starthi) << 16) \ + ) \ + | CF_LE_W(data[entry].start) \ + ) == *number; +@@ -400,35 +401,38 @@ + (*number)++; \ + } + +-static int raw_scan_sector(struct super_block *sb,int sector,const char *name, +- int *number,int *ino,struct buffer_head **res_bh, +- struct msdos_dir_entry **res_de) ++static int raw_scan_sector(struct super_block *sb, int sector, ++ const char *name, int *number, loff_t *i_pos, ++ struct buffer_head **res_bh, ++ struct msdos_dir_entry **res_de) + { ++ struct msdos_sb_info *sbi = MSDOS_SB(sb); + struct buffer_head *bh; + struct msdos_dir_entry *data; + int entry,start,done; + +- if (!(bh = fat_bread(sb,sector))) ++ if (!(bh = fat_bread(sb, sector))) + return -EIO; + data = (struct msdos_dir_entry *) bh->b_data; +- for (entry = 0; entry < MSDOS_SB(sb)->dir_per_block; entry++) { ++ for (entry = 0; entry < sbi->dir_per_block; entry++) { + /* RSS_COUNT: if (data[entry].name == name) done=true else done=false. */ + if (name) { + RSS_NAME + } else { +- if (!ino) RSS_COUNT ++ if (!i_pos) RSS_COUNT + else { + if (number) RSS_START + else RSS_FREE + } + } + if (done) { +- if (ino) +- *ino = sector * MSDOS_SB(sb)->dir_per_block + entry; ++ if (i_pos) { ++ *i_pos = ((loff_t)sector << sbi->dir_per_block_bits) + entry; ++ } + start = CF_LE_W(data[entry].start); +- if (MSDOS_SB(sb)->fat_bits == 32) { ++ if (sbi->fat_bits == 32) + start |= (CF_LE_W(data[entry].starthi) << 16); +- } ++ + if (!res_bh) + fat_brelse(sb, bh); + else { +@@ -448,16 +452,19 @@ + * requested entry is found or the end of the directory is reached. + */ + +-static int raw_scan_root(struct super_block *sb,const char *name,int *number,int *ino, +- struct buffer_head **res_bh,struct msdos_dir_entry **res_de) ++static int raw_scan_root(struct super_block *sb, const char *name, ++ int *number, loff_t *i_pos, ++ struct buffer_head **res_bh, ++ struct msdos_dir_entry **res_de) + { + int count,cluster; + + for (count = 0; + count < MSDOS_SB(sb)->dir_entries / MSDOS_SB(sb)->dir_per_block; + count++) { +- if ((cluster = raw_scan_sector(sb,MSDOS_SB(sb)->dir_start+count, +- name,number,ino,res_bh,res_de)) >= 0) ++ cluster = raw_scan_sector(sb, MSDOS_SB(sb)->dir_start + count, ++ name, number, i_pos, res_bh, res_de); ++ if (cluster >= 0) + return cluster; + } + return -ENOENT; +@@ -469,20 +476,24 @@ + * requested entry is found or the end of the directory is reached. + */ + +-static int raw_scan_nonroot(struct super_block *sb,int start,const char *name, +- int *number,int *ino,struct buffer_head **res_bh,struct msdos_dir_entry +- **res_de) ++static int raw_scan_nonroot(struct super_block *sb, int start, const char *name, ++ int *number, loff_t *i_pos, ++ struct buffer_head **res_bh, ++ struct msdos_dir_entry **res_de) + { +- int count,cluster; ++ struct msdos_sb_info *sbi = MSDOS_SB(sb); ++ int count, cluster, sector; + + #ifdef DEBUG + printk("raw_scan_nonroot: start=%d\n",start); + #endif + do { +- for (count = 0; count < MSDOS_SB(sb)->cluster_size; count++) { +- if ((cluster = raw_scan_sector(sb,(start-2)* +- MSDOS_SB(sb)->cluster_size+MSDOS_SB(sb)->data_start+ +- count,name,number,ino,res_bh,res_de)) >= 0) ++ for (count = 0; count < sbi->cluster_size; count++) { ++ sector = (start - 2) * sbi->cluster_size ++ + count + sbi->data_start; ++ cluster = raw_scan_sector(sb, sector, name, number, ++ i_pos, res_bh, res_de); ++ if (cluster >= 0) + return cluster; + } + if (!(start = fat_access(sb,start,-1))) { +@@ -506,13 +517,13 @@ + */ + + static int raw_scan(struct super_block *sb, int start, const char *name, +- int *number, int *ino, struct buffer_head **res_bh, +- struct msdos_dir_entry **res_de) ++ loff_t *i_pos, struct buffer_head **res_bh, ++ struct msdos_dir_entry **res_de) + { + if (start) +- return raw_scan_nonroot(sb,start,name,number,ino,res_bh,res_de); ++ return raw_scan_nonroot(sb,start,name,NULL,i_pos,res_bh,res_de); + else +- return raw_scan_root(sb,name,number,ino,res_bh,res_de); ++ return raw_scan_root(sb,name,NULL,i_pos,res_bh,res_de); + } + + /* +@@ -521,19 +532,21 @@ + */ + int fat_subdirs(struct inode *dir) + { +- int count; ++ struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb); ++ int number; + +- count = 0; +- if ((dir->i_ino == MSDOS_ROOT_INO) && +- (MSDOS_SB(dir->i_sb)->fat_bits != 32)) { +- (void) raw_scan_root(dir->i_sb,NULL,&count,NULL,NULL,NULL); +- } else { +- if ((dir->i_ino != MSDOS_ROOT_INO) && +- !MSDOS_I(dir)->i_start) return 0; /* in mkdir */ +- else (void) raw_scan_nonroot(dir->i_sb,MSDOS_I(dir)->i_start, +- NULL,&count,NULL,NULL,NULL); ++ number = 0; ++ if ((dir->i_ino == MSDOS_ROOT_INO) && (sbi->fat_bits != 32)) ++ raw_scan_root(dir->i_sb, NULL, &number, NULL, NULL, NULL); ++ else { ++ if ((dir->i_ino != MSDOS_ROOT_INO) && !MSDOS_I(dir)->i_start) ++ return 0; /* in mkdir */ ++ else { ++ raw_scan_nonroot(dir->i_sb, MSDOS_I(dir)->i_start, ++ NULL, &number, NULL, NULL, NULL); ++ } + } +- return count; ++ return number; + } + + +@@ -542,12 +555,12 @@ + * for an empty directory slot (name is NULL). Returns an error code or zero. + */ + +-int fat_scan(struct inode *dir,const char *name,struct buffer_head **res_bh, +- struct msdos_dir_entry **res_de,int *ino) ++int fat_scan(struct inode *dir, const char *name, struct buffer_head **res_bh, ++ struct msdos_dir_entry **res_de, loff_t *i_pos) + { + int res; + +- res = raw_scan(dir->i_sb,MSDOS_I(dir)->i_start, +- name, NULL, ino, res_bh, res_de); +- return res<0 ? res : 0; ++ res = raw_scan(dir->i_sb, MSDOS_I(dir)->i_start, name, i_pos, ++ res_bh, res_de); ++ return (res < 0) ? res : 0; + } +--- R29/fs/nls/nls_cp932.c 2004-03-24 19:56:02.000000000 +0000 ++++ R63/fs/nls/nls_cp932.c 2005-08-09 03:30:27.000000000 +0100 +@@ -7859,7 +7859,7 @@ + if (boundlen <= 0) + return -ENAMETOOLONG; + +- if (rawstring[0] <= 0x7F) { ++ if (rawstring[0] <= 0x7F || !(rawstring[1]>=0x40 && rawstring[1]<=0xFC && rawstring[1]!=0x7F)) { + *uni = rawstring[0]; + return 1; + } +--- R29/fs/nls/nls_cp936.c 2004-03-24 19:56:02.000000000 +0000 ++++ R63/fs/nls/nls_cp936.c 2005-08-09 04:01:39.000000000 +0100 +@@ -3,8 +3,10 @@ + * + * Charset cp936 translation tables. + * This translation table was generated automatically, the +- * original table can be download from the Microsoft website. +- * (http://www.microsoft.com/typography/unicode/unicodecp.htm) ++ * original table can be found at the Microsoft website. ++ * (http://www.microsoft.com/globaldev/reference/dbcs/936.htm) ++ * download GBK.TXT from MIT Edu website ++ * (http://web.mit.edu/afs/dev.mit.edu/source/src-current/third/libiconv/tests/GBK.TXT) + */ + + #include +@@ -29,7 +31,7 @@ + 0x4E63,0x4E64,0x4E65,0x4E67,0x4E68,0x4E6A,0x4E6B,0x4E6C,/* 0x60-0x67 */ + 0x4E6D,0x4E6E,0x4E6F,0x4E72,0x4E74,0x4E75,0x4E76,0x4E77,/* 0x68-0x6F */ + 0x4E78,0x4E79,0x4E7A,0x4E7B,0x4E7C,0x4E7D,0x4E7F,0x4E80,/* 0x70-0x77 */ +- 0x4E81,0xF91B,0x4E83,0x4E84,0x4E85,0x4E87,0x4E8A,0x0000,/* 0x78-0x7F */ ++ 0x4E81,0x4E82,0x4E83,0x4E84,0x4E85,0x4E87,0x4E8A,0x0000,/* 0x78-0x7F */ + + 0x4E90,0x4E96,0x4E97,0x4E99,0x4E9C,0x4E9D,0x4E9E,0x4EA3,/* 0x80-0x87 */ + 0x4EAA,0x4EAF,0x4EB0,0x4EB1,0x4EB4,0x4EB6,0x4EB7,0x4EB8,/* 0x88-0x8F */ +@@ -44,7 +46,7 @@ + 0x4F47,0x4F48,0x4F49,0x4F4A,0x4F4B,0x4F4C,0x4F52,0x4F54,/* 0xD0-0xD7 */ + 0x4F56,0x4F61,0x4F62,0x4F66,0x4F68,0x4F6A,0x4F6B,0x4F6D,/* 0xD8-0xDF */ + 0x4F6E,0x4F71,0x4F72,0x4F75,0x4F77,0x4F78,0x4F79,0x4F7A,/* 0xE0-0xE7 */ +- 0x4F7D,0x4F80,0x4F81,0x4F82,0x4F85,0xF92D,0x4F87,0x4F8A,/* 0xE8-0xEF */ ++ 0x4F7D,0x4F80,0x4F81,0x4F82,0x4F85,0x4F86,0x4F87,0x4F8A,/* 0xE8-0xEF */ + 0x4F8C,0x4F8E,0x4F90,0x4F92,0x4F93,0x4F95,0x4F96,0x4F98,/* 0xF0-0xF7 */ + 0x4F99,0x4F9A,0x4F9C,0x4F9E,0x4F9F,0x4FA1,0x4FA2,0x0000,/* 0xF8-0xFF */ + }; +@@ -69,7 +71,7 @@ + + 0x500B,0x500E,0x5010,0x5011,0x5013,0x5015,0x5016,0x5017,/* 0x80-0x87 */ + 0x501B,0x501D,0x501E,0x5020,0x5022,0x5023,0x5024,0x5027,/* 0x88-0x8F */ +- 0xF9D4,0x502F,0x5030,0x5031,0x5032,0x5033,0x5034,0x5035,/* 0x90-0x97 */ ++ 0x502B,0x502F,0x5030,0x5031,0x5032,0x5033,0x5034,0x5035,/* 0x90-0x97 */ + 0x5036,0x5037,0x5038,0x5039,0x503B,0x503D,0x503F,0x5040,/* 0x98-0x9F */ + 0x5041,0x5042,0x5044,0x5045,0x5046,0x5049,0x504A,0x504B,/* 0xA0-0xA7 */ + 0x504D,0x5050,0x5051,0x5052,0x5053,0x5054,0x5056,0x5057,/* 0xA8-0xAF */ +@@ -112,7 +114,7 @@ + 0x513C,0x513D,0x513E,0x5142,0x5147,0x514A,0x514C,0x514E,/* 0xB0-0xB7 */ + 0x514F,0x5150,0x5152,0x5153,0x5157,0x5158,0x5159,0x515B,/* 0xB8-0xBF */ + 0x515D,0x515E,0x515F,0x5160,0x5161,0x5163,0x5164,0x5166,/* 0xC0-0xC7 */ +- 0x5167,0xF978,0x516A,0x516F,0x5172,0x517A,0x517E,0x517F,/* 0xC8-0xCF */ ++ 0x5167,0x5169,0x516A,0x516F,0x5172,0x517A,0x517E,0x517F,/* 0xC8-0xCF */ + 0x5183,0x5184,0x5186,0x5187,0x518A,0x518B,0x518E,0x518F,/* 0xD0-0xD7 */ + 0x5190,0x5191,0x5193,0x5194,0x5198,0x519A,0x519D,0x519E,/* 0xD8-0xDF */ + 0x519F,0x51A1,0x51A3,0x51A6,0x51A7,0x51A8,0x51A9,0x51AA,/* 0xE0-0xE7 */ +@@ -130,7 +132,7 @@ + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x28-0x2F */ + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x30-0x37 */ + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x38-0x3F */ +- 0x51D8,0x51D9,0x51DA,0xF954,0xFA15,0x51DF,0x51E2,0x51E3,/* 0x40-0x47 */ ++ 0x51D8,0x51D9,0x51DA,0x51DC,0x51DE,0x51DF,0x51E2,0x51E3,/* 0x40-0x47 */ + 0x51E5,0x51E6,0x51E7,0x51E8,0x51E9,0x51EA,0x51EC,0x51EE,/* 0x48-0x4F */ + 0x51F1,0x51F2,0x51F4,0x51F7,0x51FE,0x5204,0x5205,0x5209,/* 0x50-0x57 */ + 0x520B,0x520C,0x520F,0x5210,0x5213,0x5214,0x5215,0x521C,/* 0x58-0x5F */ +@@ -143,16 +145,16 @@ + 0x5264,0x5266,0x5268,0x526B,0x526C,0x526D,0x526E,0x5270,/* 0x88-0x8F */ + 0x5271,0x5273,0x5274,0x5275,0x5276,0x5277,0x5278,0x5279,/* 0x90-0x97 */ + 0x527A,0x527B,0x527C,0x527E,0x5280,0x5283,0x5284,0x5285,/* 0x98-0x9F */ +- 0x5286,0x5287,0xF9C7,0x528A,0x528B,0x528C,0x528D,0x528E,/* 0xA0-0xA7 */ ++ 0x5286,0x5287,0x5289,0x528A,0x528B,0x528C,0x528D,0x528E,/* 0xA0-0xA7 */ + 0x528F,0x5291,0x5292,0x5294,0x5295,0x5296,0x5297,0x5298,/* 0xA8-0xAF */ + 0x5299,0x529A,0x529C,0x52A4,0x52A5,0x52A6,0x52A7,0x52AE,/* 0xB0-0xB7 */ + 0x52AF,0x52B0,0x52B4,0x52B5,0x52B6,0x52B7,0x52B8,0x52B9,/* 0xB8-0xBF */ + 0x52BA,0x52BB,0x52BC,0x52BD,0x52C0,0x52C1,0x52C2,0x52C4,/* 0xC0-0xC7 */ + 0x52C5,0x52C6,0x52C8,0x52CA,0x52CC,0x52CD,0x52CE,0x52CF,/* 0xC8-0xCF */ + 0x52D1,0x52D3,0x52D4,0x52D5,0x52D7,0x52D9,0x52DA,0x52DB,/* 0xD0-0xD7 */ +- 0x52DC,0x52DD,0xF92F,0x52E0,0x52E1,0x52E2,0x52E3,0x52E5,/* 0xD8-0xDF */ ++ 0x52DC,0x52DD,0x52DE,0x52E0,0x52E1,0x52E2,0x52E3,0x52E5,/* 0xD8-0xDF */ + 0x52E6,0x52E7,0x52E8,0x52E9,0x52EA,0x52EB,0x52EC,0x52ED,/* 0xE0-0xE7 */ +- 0x52EE,0x52EF,0x52F1,