Script started on Tue May 7 12:03:19 2002 [tom@localhost device]$ patch < ~/tbr.pch < ~/tbr.pch- < ~/tbr.pchp < ~/tbr.pch0 < ~/tbr.pch < ~/tbr.pch sh: get: command not found warning: Patching file bi/pxa.c, which does not match default SCCS version patching file bi/pxa.c Hunk #3 succeeded at 931 (offset 1 line). Hunk #5 succeeded at 955 (offset 1 line). sh: get: command not found warning: Patching file bi/pxa.h, which does not match default SCCS version patching file bi/pxa.h Hunk #2 succeeded at 30 with fuzz 2 (offset -5 lines). sh: get: command not found warning: Patching file usbd-monitor.c, which does not match default SCCS version patching file usbd-monitor.c [tom@localhost device]$ ls bi ep0.c Makefile SCCS usbd-bus.c usbd-debug.c usbd-func.h usbd-module.h Config.help hotplug.c net_fd serial_fd usbd-bus.h usbd-debug.h usbd.h usbd-monitor.c Config.in hotplug.h pch.0 usbd-arch.h usbd.c usbd-func.c usbd-inline.h usbd-serialnumber.c [tom@localhost device]$ vi usbd-monitor.c [?1h="usbd-monitor.c" [readonly] 785L, 17550C/* * linux/drivers/usbd/usbd-monitor.c - USB Device Cable Monitor * * Copyright (c) 2000, 2001, 2002 Lineo * Copyright (c) 2001 Hewlett Packard * * By: * Stuart Lynne , * Tom Rushworth , * Bruce Balden * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include #include #include "usbd-export.h" #include "usbd-build.h" #include "usbd-module.h" MODULE_AUTHOR ("sl@lineo.com, tbr@lineo.com"); MODULE_DESCRIPTION ("USB Device Monitor"); USBD_MODULE_INFO ("usbd_monitor 0.3"); EXPORT_NO_SYMBOLS; #include #include #include #include #include #include #include   #include  #include  #include  #include  #include  #include  #include  #include  #include  #include    /*  * Architecture specific includes  */   #if defined(CONFIG_ARCH_SA1100) || defined(CONFIG_SABINAL_DISCOVERY)   #include  #include   #include "usbd.h"  #include "usbd-func.h"  #include "usbd-bus.h"  #include "hotplug.h"  /* pick up any required GPIO pin definitions */  #if defined(CONFIG_ARCH_SA1100)  #include "bi/sa1100.h"  #endif  #endif   #if defined(CONFIG_PM)  #include  #endif    /* Module Parameters ************************************************************************* */   typedef enum monitor_status {  MONITOR_UNKNOWN, MONITOR_LOADING,// loading due to cable connection interrupt MONITOR_LOADED,// loaded MONITOR_UNLOADING, // unloading due to cable disconnection interrupt MONITOR_UNLOADED,// unloaded #ifdef CONFIG_PM  MONITOR_SUSPENDING, // suspending due to power management event MONITOR_SUSPENDED, // suspended due to power management event MONITOR_RESTORING, // restoring #endif  } monitor_status_t;   /* struct monitor_bi_data -  *  * private data structure for this bus interface driver  */  struct monitor_data {  monitor_status_t status; struct tq_struct monitor_bh; struct tq_struct hotplug_bh;  int have_irq; #ifdef CONFIG_PM  struct pm_dev *pm_info; #endif   };   struct monitor_data monitor;  void monitor_int_hndlr (int irq, void *dev_id, struct pt_regs *regs);   /**  * monitor_request_irq  */  int monitor_request_irq (void)  { #if defined(CONFIG_SA1100_USBCABLE_GPIO)  int rc;  printk (KERN_DEBUG "monitor_request_irq: %d %d\n", CONFIG_SA1100_USBCABLE_GPIO, SA1100_GPIO_TO_IRQ (CONFIG_SA1100_USBCABLE_GPIO));  if ((rc = request_irq (SA1100_GPIO_TO_IRQ (CONFIG_SA1100_USBCABLE_GPIO), monitor_int_hndlr, SA_SHIRQ, "USBD Monitor", &monitor))) { printk (KERN_DEBUG "monitor_request_irq: failed: %d\n", rc); return -EINVAL; } GPDR &= ~GPIO_GPIO (CONFIG_SA1100_USBCABLE_GPIO); set_GPIO_IRQ_edge (GPIO_GPIO (CONFIG_SA1100_USBCABLE_GPIO), GPIO_BOTH_EDGES); #endif  return 0; }  /**  * monitor_free_irq  */  void monitor_free_irq (void)  { #if defined(CONFIG_SA1100_USBCABLE_GPIO)  free_irq (SA1100_GPIO_TO_IRQ (CONFIG_SA1100_USBCABLE_GPIO), NULL); #endif  }   /**  * monitor_connected - connected to cable  *  * Return non-zero if via USB cable to USB Hub or Host  */  int monitor_connected (void)  { int rc = 1;  /* * Architecture specific - determine connect status */  /* * SA-1100 * /free_irq // XXX monitor.hotplug_bh.sync = 0;/** Architecture specific - request IRQ*/if (!monitor_request_irq ()) {monitor.have_irq++;} else {printk (KERN_DEBUG "usbdm: request irq failed\n");} #ifdef CONFIG_PM/** Architecture specific - register with power management*/monitor.pm_info = NULL;if (!(monitor.pm_info = pm_register (PM_USB_DEV, PM_SYS_UNKNOWN, monitor_pm_event))) {printk (KERN_ERR "%s: couldn't register for power management\n", __FUNCTION__);if (monitor.have_irq) {monitor_free_irq ();}return 1;}monitor.pm_info->state = 0; #endif #ifdef CONFIG_USBD_PROCFS{struct proc_dir_entry *p;// create proc filesystem entriesif ((p = create_proc_entry ("usb-monitor", 0, 0)) == NULL) {if (monitor.have_irq) {monitor_free_irq ();monitor.have_irq = 0;} #ifdef CONFIG_PMif (monitor.pm_info) {pm_unregister (monitor.pm_info);monitor.pm_info = NULL;} #endifreturn -ENOMEM;}/free_irq printk (KERN_INFO "monitor_modinit: finished\n");return 0; } /** * monitor_modexit - decommission bus interface driver * */ static void __exit monitor_modexit (void) {printk (KERN_INFO "\n");printk (KERN_INFO "monitor_modexit:\n");/* Stop any hotplug actions except unload */monitor_exiting = 1;/** Architecture specific - free appropriate IRQ*/monitor_free_irq (); #ifdef CONFIG_PMif (monitor.pm_info) {pm_unregister (monitor.pm_info);monitor.pm_info = NULL;} #endif/** Force unloading*/monitor_hotplug (MHA_UNLOAD); #ifdef CONFIG_USBD_PROCFS// remove proc filesystem entry *AFTER* the last hotplug,// in case it is being used for sync hotplug.remove_proc_entry ("usb-monitor", NULL); #endifreturn; } module_init (monitor_modinit);/free_irq search hit BOTTOM, continuing at TOP/** * monitor_request_irq */ int monitor_request_irq (void) { #if defined(CONFIG_SA1100_USBCABLE_GPIO)int rc;printk (KERN_DEBUG "monitor_request_irq: %d %d\n", CONFIG_SA1100_USBCABLE_GPIO, SA1100_GPIO_TO_IRQ (CONFIG_SA1100_USBCABLE_GPIO));if ((rc = request_irq (SA1100_GPIO_TO_IRQ (CONFIG_SA1100_USBCABLE_GPIO), monitor_int_hndlr, SA_SHIRQ, "USBD Monitor", &monitor))) {printk (KERN_DEBUG "monitor_request_irq: failed: %d\n", rc);return -EINVAL;}GPDR &= ~GPIO_GPIO (CONFIG_SA1100_USBCABLE_GPIO);set_GPIO_IRQ_edge (GPIO_GPIO (CONFIG_SA1100_USBCABLE_GPIO), GPIO_BOTH_EDGES); #endifreturn 0; } /** * monitor_free_irq */ void monitor_free_irq (void) { #if defined(CONFIG_SA1100_USBCABLE_GPIO)free_irq (SA1100_GPIO_TO_IRQ (CONFIG_SA1100_USBCABLE_GPIO), NULL); #endif } /** * monitor_connected - connected to cable * * Return non-zero if via USB cable to USB Hub or Host */ int monitor_connected (void) {int rc = 1;/** Architecture specific - determine connect status*//** SA-1100 search hit BOTTOM, continuing at TOP/free_irq// XXX monitor.hotplug_bh.sync = 0;/** Architecture specific - request IRQ*/if (!monitor_request_irq ()) {monitor.have_irq++;} else {printk (KERN_DEBUG "usbdm: request irq failed\n");} #ifdef CONFIG_PM/** Architecture specific - register with power management*/monitor.pm_info = NULL;if (!(monitor.pm_info = pm_register (PM_USB_DEV, PM_SYS_UNKNOWN, monitor_pm_event))) {printk (KERN_ERR "%s: couldn't register for power management\n", __FUNCTION__);if (monitor.have_irq) {monitor_free_irq ();}return 1;}monitor.pm_info->state = 0; #endif #ifdef CONFIG_USBD_PROCFS{struct proc_dir_entry *p;// create proc filesystem entriesif ((p = create_proc_entry ("usb-monitor", 0, 0)) == NULL) {if (monitor.have_irq) {monitor_free_irq ();monitor.have_irq = 0;} #ifdef CONFIG_PMif (monitor.pm_info) {pm_unregister (monitor.pm_info);monitor.pm_info = NULL;} #endifreturn -ENOMEM;}/free_irq printk (KERN_INFO "monitor_modinit: finished\n");return 0; } /** * monitor_modexit - decommission bus interface driver * */ static void __exit monitor_modexit (void) {printk (KERN_INFO "\n");printk (KERN_INFO "monitor_modexit:\n");/* Stop any hotplug actions except unload */monitor_exiting = 1;/** Architecture specific - free appropriate IRQ*/monitor_free_irq (); #ifdef CONFIG_PMif (monitor.pm_info) {pm_unregister (monitor.pm_info);monitor.pm_info = NULL;} #endif/** Force unloading*/monitor_hotplug (MHA_UNLOAD); #ifdef CONFIG_USBD_PROCFS// remove proc filesystem entry *AFTER* the last hotplug,// in case it is being used for sync hotplug.remove_proc_entry ("usb-monitor", NULL); #endifreturn; } module_init (monitor_modinit);/free_irq search hit BOTTOM, continuing at TOP/** * monitor_request_irq */ int monitor_request_irq (void) { #if defined(CONFIG_SA1100_USBCABLE_GPIO)int rc;printk (KERN_DEBUG "monitor_request_irq: %d %d\n", CONFIG_SA1100_USBCABLE_GPIO, SA1100_GPIO_TO_IRQ (CONFIG_SA1100_USBCABLE_GPIO));if ((rc = request_irq (SA1100_GPIO_TO_IRQ (CONFIG_SA1100_USBCABLE_GPIO), monitor_int_hndlr, SA_SHIRQ, "USBD Monitor", &monitor))) {printk (KERN_DEBUG "monitor_request_irq: failed: %d\n", rc);return -EINVAL;}GPDR &= ~GPIO_GPIO (CONFIG_SA1100_USBCABLE_GPIO);set_GPIO_IRQ_edge (GPIO_GPIO (CONFIG_SA1100_USBCABLE_GPIO), GPIO_BOTH_EDGES); #endifreturn 0; } /** * monitor_free_irq */ void monitor_free_irq (void) { #if defined(CONFIG_SA1100_USBCABLE_GPIO)free_irq (SA1100_GPIO_TO_IRQ (CONFIG_SA1100_USBCABLE_GPIO), NULL); #endif } /** * monitor_connected - connected to cable * * Return non-zero if via USB cable to USB Hub or Host */ int monitor_connected (void) {int rc = 1;/** Architecture specific - determine connect status*//** SA-1100 search hit BOTTOM, continuing at TOP:q [?1l>[tom@localhost device]$ exit Script done on Tue May 7 12:07:24 2002