diff -urN -X dontdiffjava USBMon-0.2a/COPYING USBMon-0.3/COPYING --- USBMon-0.2a/COPYING 1969-12-31 16:00:00.000000000 -0800 +++ USBMon-0.3/COPYING 2005-01-28 16:31:29.000000000 -0800 @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff -urN -X dontdiffjava USBMon-0.2a/README.txt USBMon-0.3/README.txt --- USBMon-0.2a/README.txt 2001-06-01 09:03:27.000000000 -0700 +++ USBMon-0.3/README.txt 2005-03-27 15:38:58.000000000 -0800 @@ -1,15 +1,18 @@ -README for USBMon 0.2 +README for USBMon 0.3 +2005/03/27 +Introduction: -Included files: +The USBMon is a graphical tool to capture traffic on USB bus (in theory). +In practice, release 0.3 is practically useless. It is intended to keep +the useful source code. -README - This File -USBMon-0.2-kernel-2.4.1.diff - Kernel patch for 2.4.1 +Included files: -USBMon-0.2-kernel-2.4.4.diff - Kernel patch for 2.4.4 +README.txt - This File -USBMon/* - Java Monitoring Application +USBMon/* - The Monitoring Application Installation: @@ -17,29 +20,24 @@ Kernel Patch: -patch the kernel in the normal way by cd-ing to /usr/src/linux and typing: -patch -p1 < patchfile. Where patchfile is the correct version patchfile. -then re-compile your kernel and either load in the modules or re-boot. -For anything to be effective you must have usbdevfs mounted as normal at -/proc/bus/usb +This version of USBMon uses built-in usbmon services available in kernel 2.6.11 +and later. Additional patches are not necessary. Therefore, USBMon does not +distribute any kernel patches anymore. -Java Application: +Build and run: This may require Java 1.3 (I'm not sure and I only have a jdk 1.3 system). -- cd to the USBMon directory. type 'javac *.java' to compile it (if anything - goes wrong mail me with details). +- cd to the USBMon directory. Examine file Makefile and adjust settings. + Type 'make' to compile it. - then make sure that the directory is included in $CLASSPATH -- then type 'java USBMon' to start it up. NB: YOU MUST BE ROOT IN ORDER TO SET - THE MONITORING LEVEL OF AN ENDPOINT. i.e. USBMon is useless unless you are - root. - +- then type 'java USBMon' to start it up. -Known Bugs / Defects / features :- +Known Bugs / Defects / features: 1. Hotplugging not really supported - USBMon doesn't yet poll the /proc/bus/usb/devices file. It simply checks it when the monitoring application @@ -49,16 +47,12 @@ 2. Alternate Interfaces may be a problem, working out how to deal with them - the behavior may be unpredictable (but should be safe!). -3. Lots of useless debug to stdout from the java app but hey Mozilla does it :-) - -3. All testing has been done on usb-uhci, uhci may work but I don't know.... - 4. I havn't tried this on high bandwidth Isochronous pipes, that would be interesting... - Away you go... -Dave Harding (dave.harding@ed.ac.uk). +This document was originated by Dave Harding (as dave.harding@ed.ac.uk: the +e-mail address is no longer functional). diff -urN -X dontdiffjava USBMon-0.2a/USBMon/Bus.java USBMon-0.3/USBMon/Bus.java --- USBMon-0.2a/USBMon/Bus.java 2001-06-01 09:03:27.000000000 -0700 +++ USBMon-0.3/USBMon/Bus.java 2005-03-14 22:50:36.000000000 -0800 @@ -68,8 +68,14 @@ * */ public int num_iso; - - + + /** + * This is the mfilereader for this bus. This is basically a + * placeholder to keep a link to the thread that reads the + * /sys/kernel/debug/usbmon/0t. + */ + public Mfilereader mfilereader; + /** * Search for a particular device and return it. * @@ -107,14 +113,17 @@ rc.append("Bus Number "); rc.append(number); rc.append("\n"); - rc.append(root_hub.toString(1)); + if (root_hub != null) + rc.append(root_hub.toString(1)); return(rc.toString()); } - public Bus(int bus_no){ number=bus_no; } - + + public void readStart(Bus bus) { + mfilereader = new Mfilereader(bus); + } } diff -urN -X dontdiffjava USBMon-0.2a/USBMon/Device.java USBMon-0.3/USBMon/Device.java --- USBMon-0.2a/USBMon/Device.java 2001-06-01 09:03:27.000000000 -0700 +++ USBMon-0.3/USBMon/Device.java 2005-03-14 17:42:01.000000000 -0800 @@ -40,16 +40,9 @@ { /** - * The number bus that this device is on. + * Our bus */ - public int bus_num; - - - /** - * The root_hub device - */ - public Device root_hub; - + public Bus bus; /** * The Primary Control Pipe that all USB devices must have. @@ -186,18 +179,7 @@ * The list of URBs monitored on this device */ public Vector URB_list; - - /** - * This is the mfilereader for this device. This is basically a - * placeholder to keep a link to the timer thread that reads the - * ***M files and updates them. - */ - public Mfilereader mfilereader; - - - public int max_monitoring_level; - - + /** * This holds the Configurations Pane that is plays the tables of * interfaces and Endpoints. @@ -283,7 +265,7 @@ */ public Object getRoot() { - return(root_hub); + return(bus.root_hub); } /** @@ -658,7 +640,7 @@ public String details() { return( "Device Number:"+'\t'+num+'\n'+ - "Bus:"+'\t'+'\t'+bus_num+'\n'+ + "Bus:"+'\t'+'\t'+bus.number+'\n'+ "Level:"+'\t'+'\t'+level+'\n'+ "Parent ID:"+'\t'+'\t'+parent+'\n'+ "parent port:"+'\t'+'\t'+parent_port+'\n'+ @@ -680,15 +662,12 @@ } - - public Device(){ - + public Device(Bus bus0){ cfg_list = new Vector(); children = new Vector(); URB_list = new Vector(); num_endpoints=1; - + bus = bus0; } - } diff -urN -X dontdiffjava USBMon-0.2a/USBMon/endpoint.java USBMon-0.3/USBMon/endpoint.java --- USBMon-0.2a/USBMon/endpoint.java 2001-06-01 09:03:27.000000000 -0700 +++ USBMon-0.3/USBMon/endpoint.java 2005-03-08 18:20:06.000000000 -0800 @@ -93,6 +93,18 @@ */ public int monitoring_level; + /** + * Create an address for printouts + */ + public String toAddrString() { + StringBuffer rv = new StringBuffer(20); + + rv.append(dev.bus.number); + rv.append(":"); + rv.append(dev.num); + rv.append("\n"); + return rv.toString(); + } /** * @@ -101,43 +113,10 @@ java.io.FileNotFoundException { - try{ - StringBuffer str = new StringBuffer(); - byte[] buf = new byte[4]; - - str.append("/proc/bus/usb/"); - if(dev.bus_num < 100){ - str.append("0"); - } - if(dev.bus_num < 10){ - str.append("0"); - } - str.append(dev.bus_num); - str.append("/"); - if(dev.num < 100){ - str.append("0"); - } - if(dev.num < 10){ - str.append("0"); - } - str.append(dev.num); - str.append("M"); - FileOutputStream file = new FileOutputStream(str.toString()); - - buf[0]=69; // the letter E - buf[1]=(byte)number; - buf[2]=76; // The letter L - buf[3]=(byte)val; - file.write(buf); - file.close(); - monitoring_level=val; - }catch(Exception e){ - if(e != new FileNotFoundException()){ - System.out.println(e.toString()); - }else{ - throw new FileNotFoundException(); - } - } + System.out.println("e m level " + val); // P3 + monitoring_level=val; + /* XXX Implement this ...... */ + System.out.println("e m level done"); // P3 } diff -urN -X dontdiffjava USBMon-0.2a/USBMon/Makefile USBMon-0.3/USBMon/Makefile --- USBMon-0.2a/USBMon/Makefile 1969-12-31 16:00:00.000000000 -0800 +++ USBMon-0.3/USBMon/Makefile 2005-01-28 16:31:29.000000000 -0800 @@ -0,0 +1,48 @@ +# This Makefile is a part of USBMon +# This file is licensed under GPL v.2, see file COPYING for details. + +JAVA = java +JAR = jar +#JAVAC = gcj -C +JAVAC = /usr/java/jdk1.5.0_01/bin/javac +#DEBUG = -g -deprecation +DEBUG = -O +# JFLAGS = -classpath $(CLASSPATH):jar/cryptix.jar:. +JFLAGS = + +.SUFFIXES: .java .class + +# compile java files to class +.java.class: + $(JAVAC) $(DEBUG) $(JFLAGS) $< + +CLASSES = \ + Bus.class \ + cfg.class \ + Device.class \ + endpoint.class \ + i_f.class \ + Mfilereader.class \ + procfilehandler.class \ + URB.class \ + USBMon.class \ + usb_search_exception.class + +all: $(CLASSES) + +#jar: app build +# @echo Creating binary archive ... +# @if [ ! -d jar ]; then mkdir jar; fi +# @touch "Created-$(DATE)" +# @$(JAR) cvfm jar/$(PKGNAME).jar jta.manifest \ +# "Created-$(DATE)" README \ +# license/COPYING license/COPYING.LIB \ +# de/mud/ssh/license.txt \ +# `find $(SRCDIR) -name *.class` \ +# `find $(SRCDIR) -name \*.conf` > /dev/null +# @rm -f Created-* +# @echo Created jar/$(PKGNAME).jar + +# rm -f $(CLASSES) <-- too many file$name.class +clean: + rm -f *.class diff -urN -X dontdiffjava USBMon-0.2a/USBMon/Mfilereader.java USBMon-0.3/USBMon/Mfilereader.java --- USBMon-0.2a/USBMon/Mfilereader.java 2001-06-01 09:03:27.000000000 -0700 +++ USBMon-0.3/USBMon/Mfilereader.java 2005-03-23 19:25:24.000000000 -0800 @@ -31,118 +31,308 @@ * @version 0.1 */ +// This is not needed because of Map +// class ActiveNode implements Comparable { +// long tag; +// URB urb; +// +// static Class lclass = (new Long(0)).getClass(); +// static Class aclass = (new ActiveNode(0, null)).getClass(); +// +// ActiveNode(long tag0, URB urb0) { +// tag = tag0; +// urb = urb0; +// } +// +// public boolean equals(Object p) throws ClassCastException { +// Class pclass = p.getClass(); +// if (pclass == aclass) { +// ActiveNode a = (ActiveNode) p; +// return this.tag == a.tag; +// } +// if (pclass == lclass) { +// return this.tag == ((Long) p).longValue(); +// } +// throw new ClassCastException(); +// } +// +// public int compareTo(Object p) { +// Class pclass = p.getClass(); +// if (pclass == aclass) { +// long atag = ((ActiveNode) p).tag; +// /* +// * This cases "loss of precision" warnings: +// * return this.tag - a.tag; +// */ +// if (this.tag < atag) +// return -1; +// if (this.tag > atag) +// return 1; +// return 0; +// } +// if (pclass == lclass) { +// // return this.tag - ((Long) p).longValue(); +// long ptag = ((Long) p).longValue(); +// if (this.tag < ptag) +// return -1; +// if (this.tag > ptag) +// return 1; +// return 0; +// } +// throw new ClassCastException(); +// } +// } + public class Mfilereader { - Timer timer; - int wait_time; - String filename; - Bus Bus; - Device Dev; + FileInputStream mreader; // This has .close() method + ReaderTask rtask; + TreeMap active; /** - * Generator Method that takes a path to a ***M file and a delay. + * Generator Method */ - public Mfilereader(String path, Bus bus, Device dev, int delay) { - timer = new Timer(); - wait_time=delay; - filename=path; - Bus=bus; - Dev=dev; - timer.schedule(new RepTask(), 1000, wait_time*1000); - System.out.println("Mfilereader created. Device " + dev ); + public Mfilereader(Bus bus) { + /* + * We cannot pass the bus pointer because our constructor + * is called from the Bus constructor. So we look it up later. + */ + mreader = null; + rtask = null; + + active = new TreeMap(); + + String fname = "/sys/kernel/debug/usbmon/" + bus.number + "t"; + + File mfile = null; + try { + mfile = new File(fname); + } catch (Exception e) { + System.err.println("Mfilereader new File " + fname); + System.err.println(e); + mfile = null; + } + + if (mfile != null) { + try { + mreader = new FileInputStream(mfile); + } catch (FileNotFoundException e) { + /* + * The EPERM ends here as well. + * So, we do not report "File not found". + */ + System.err.println("Cannot open " + fname + + ". The usbmon is not available."); + // XXX Pop up a dialog. Only once. + } catch (Exception e) { + System.err.println("Mfilereader new FileInputStream " + fname); + System.err.println(e.toString()); + mreader = null; + } + } + + if (mreader != null) { + try { + rtask = new ReaderTask(bus); + rtask.start(); + } catch (Exception e) { + System.err.println("Mfilereader new ReaderTask " + fname); + System.err.println(e.toString()); + rtask = null; + } + } } - class RepTask extends TimerTask{ + /* + * This is not called "ParsedURB" because one URB can receive + * several updates during its lifetime. + * + * A few strings can be empty depending on type, pipe, etc. + */ + class ParsedLine { + Long tag; + Long stamp; + String type; + char utype; /* Z: ISO, I: int, C: ctl, B: bulk */ + int dir; /* Direction: 1 = Input */ + int devnum; + int epnum; + int status; + int xfer_len; /* Reported length */ + int data_len; /* Available length of data */ + byte data[]; + +// cd85d0e8 2371232648 S Bi:003:01 -115 13 < +// cd85d0e8 2371233379 C Bi:003:01 0 13 = 55534253 5e000000 00000000 00 +// dec9f284 2372620182 C Ii:001:01 0 1 D +// dec9f284 2372620192 S Ii:001:01 -115 2 D +// d07a29a0 2372620212 S Ci:001:00 -115 4 < +// d07a29a0 2372620219 C Ci:001:00 0 4 = 00010100 + public ParsedLine(String line) { + tag = new Long(0); + /* + * Constructor is ended at this point. Initiator starts. + */ + + StringTokenizer st = new StringTokenizer(line); + if (!st.hasMoreTokens()) { + System.err.println("No tag token"); // P3 + return; + } + String tag_str = st.nextToken(); + try { + tag = Long.parseLong(tag_str, 16); + } catch (NumberFormatException e) { + return; + } + + if (!st.hasMoreTokens()) { + System.err.println("No timestamp token"); // P3 + return; + } + String stamp_str = st.nextToken(); + try { + /* + * The usbmon only returns 32 bits of timestamp, but + * a) they are unsigned + * b) it can return more in the future + */ + stamp = Long.parseLong(stamp_str); + } catch (NumberFormatException e) { + stamp = new Long(-1); + } + + if (!st.hasMoreTokens()) { + System.err.println("No type token"); // P3 + return; + } + type = st.nextToken(); + + if (!st.hasMoreTokens()) { + System.err.println("No pipe token"); // P3 + return; + } + String pipe_str = st.nextToken(); + /* Ci:001:00 is Control:Input:Device=1:Endpoint=0 */ + utype = pipe_str.charAt(0); + dir = (pipe_str.charAt(1) == 'i') ? 1 : 0; + devnum = Integer.parseInt(pipe_str.substring(3, 6)); + epnum = Integer.parseInt(pipe_str.substring(7, 9)); + + if (!st.hasMoreTokens()) { + System.err.println("No status token"); // P3 + return; + } + String status_str = st.nextToken(); + try { + status = Integer.valueOf(Integer.parseInt( + status_str)); + } catch (NumberFormatException e) { + status = new Integer(-1); + } + + if (!st.hasMoreTokens()) { + System.err.println("No length token"); // P3 + return; + } + String length_str = st.nextToken(); + try { + xfer_len = Integer.valueOf(Integer.parseInt( + length_str)); + } catch (NumberFormatException e) { + xfer_len = new Integer(0); + } + + if (!st.hasMoreTokens()) { + System.err.println("No data mark token"); // P3 + return; + } + String mark_str = st.nextToken(); + + /* + * The mark tells us if data is available, + * and if not, why not. The data string is truncated at + * a system defined length to keep cat lines reasonable. + * So, the reported data length may be greater than + * available data length. + * + * Data words are always in big endian format and + * four byte maximum. This is done because they + * actually constitute a byte stream, which is read + * left to right by humans. + */ + if (mark_str.charAt(0) == '=') { + parseData(st); + } else { + data = null; + data_len = 0; + } + + } + + /* + * parseData has side effects, alas, because it has to return + * both data and its size (data_len). Also, it advances st. + */ + void parseData(StringTokenizer st) { + int availwords = st.countTokens(); + data = new byte[availwords * 4]; + data_len = 0; + while (st.hasMoreTokens()) { + String data_str = st.nextToken(); + int len = data_str.length() / 2; + int i; + for (i = 0; i < len; i++) { + data[data_len] = Byte.parseByte( + data_str.substring(i*2, i*2 + 2), + 16); + data_len++; + } + } + } + } + + class ReaderTask extends Thread { + Bus bus; + + ReaderTask(Bus bus0) { + bus = bus0; + } + public void run() { try{ - String str; - //if(Dev.num==2){ - //str = new String("dummy_M_file"); - //}else{ - str = filename; - //} - File mfile = /**new File(filename);*/ - new File(str); - - - FileInputStream mreader= - new FileInputStream(mfile); - StringBuffer c; String c_str; - char temp_char[]=new char[1]; - int rc, i,dp; - byte temp_byte[]=new byte[1]; - byte data[]=new byte[2048]; - byte data_header[]=new byte[203]; - byte data_only[]; - boolean modified=false; - int tempi, size; - Integer temp_Integer; - - //System.out.println("Time's up!"); + int rc; + byte line[] = new byte[500]; + ParsedLine pline; rc=0; while(rc != -1){ - c = new StringBuffer(); URB urb; - rc=mreader.read(temp_byte); - if((temp_byte[0] == '[') && (rc != -1)){ - mreader.read(data_header); - c_str = new String(data_header, - 0, - 203); - + + rc = mreader.read(line); + if (rc <= 0) { + System.err.println("Mfilereader read error " + rc); + break; + } + /* + * Convert to String (to allow tokenizing), + * and throw away the terminating newline. + */ + c_str = new String(line, 0, rc-1, "US-ASCII"); System.out.println(c_str); - /** - * Lets see of we have data - * to get. - */ - - tempi=c_str.indexOf("dp="); - temp_Integer = new Integer( - c_str.substring(tempi+3,tempi+4).trim()); - dp=temp_Integer.intValue(); - - if(dp != 0){ - /** - * Lets find the size - */ - - tempi=c_str.indexOf("size="); - temp_Integer = new Integer( - c_str.substring(tempi+5,tempi+14).trim()); - size=temp_Integer.intValue(); - - System.out.println("size set to "+size); - - data_only=new byte[size]; - - for(i=0;i - #include - #include -+#include /*for USBMon*/ - - - struct async { -@@ -57,6 +58,7 @@ - - static loff_t usbdev_lseek(struct file *file, loff_t offset, int orig) - { -+ printk("usbdev_lseek called.\n"); - switch (orig) { - case 0: - file->f_pos = offset; -@@ -1214,3 +1216,410 @@ - open: usbdev_open, - release: usbdev_release, - }; -+ -+ -+/*************************** USBMon Addition *********************************/ -+ -+ -+static int usbmon_open(struct inode *inode, struct file *file) -+{ -+ struct usb_device *dev; -+ int ret; -+ -+ /*printk("[USBMon] usbmon_open called with inode=&%X\n",inode);*/ -+ -+ lock_kernel(); -+ ret = -ENOENT; -+ if (ITYPE(inode->i_ino) != IDEVICEMON) -+ goto out; -+ dev = inode->u.usbdev_i.p.dev; -+ if (!dev) -+ goto out; -+ -+ ret = 0; -+ -+ dev->USBMon_data->USBMon_urb_ll_buffered = -+ dev->USBMon_data->USBMon_urb_ll_head; -+ wmb(); -+ dev->USBMon_data->USBMon_urb_ll_head = NULL; -+ wmb(); -+ dev->USBMon_data->USBMon_urb_ll_last = NULL; -+ wmb(); -+ -+ file->private_data = dev; -+ out: -+ unlock_kernel(); -+ return ret; -+} -+ -+static int usbmon_release(struct inode *inode, struct file *file) -+{ -+ urb_t *temp_urb1, *temp_urb2; -+ struct usb_device *dev; -+ -+ dev = (struct usb_device *)(file->private_data); -+ -+ temp_urb1=dev->USBMon_data->USBMon_urb_ll_buffered; -+ -+ wmb(); -+ -+ dev->USBMon_data->USBMon_urb_ll_buffered=NULL; -+ -+ -+ while(temp_urb1 != NULL){ -+ temp_urb2 = temp_urb1; -+ if(temp_urb1->transfer_buffer){ -+ kfree(temp_urb1->transfer_buffer); -+ } -+ temp_urb1=temp_urb1->next; -+ kfree(temp_urb2); -+ } -+ return 0; -+} -+ -+static ssize_t usbmon_read(struct file *file, char * buf, size_t nbytes, loff_t *ppos) -+{ -+ ssize_t ret = 0; -+ unsigned int len=0; -+ unsigned int already_copied=0; -+ unsigned int skipped=0; -+ int i; -+ loff_t pos; -+ char a[5120]; -+ char b[10]; -+ struct usb_device *dev; -+ urb_t *purb; -+ int finished=0; -+ -+ pos = *ppos; -+ -+ if (!file->private_data) { -+ ret = -ENODEV; -+ goto err; -+ } else if (pos < 0) { -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ dev=(struct usb_device *)file->private_data; -+ -+ /*printk("[USBMon] read on device %d, buffered=%8X\n", -+ dev->devnum, -+ dev->USBMon_data->USBMon_urb_ll_buffered); -+ */ -+ -+ purb = dev->USBMon_data->USBMon_urb_ll_buffered; -+ -+ if(purb == NULL){ -+ finished=1; -+ } -+ while(finished == 0){ -+ { -+ int dp=0, al=0; -+ if(purb->transfer_buffer == NULL){ -+ dp=0; -+ }else{ -+ dp=1; -+ } -+ sprintf(a,"[URB completed on Device=%03d, " -+ "Endpoint=%02d, Pipe=%08X, " -+ "status= % 03d, size= %08d, transfer_flags = " -+ "%08X, actual_length = %08d, " -+ "error count = %05d completion_time = %02d" -+ ":%02d:%02d:%06d dp=%d data=", -+ purb->dev->devnum, -+ (purb->pipe & (0xf <<15))>>15, -+ purb->pipe, -+ purb->status, -+ purb->transfer_buffer_length, -+ purb->transfer_flags, -+ purb->actual_length, -+ purb->error_count, -+ -+ ((purb->completion_time).tv_sec%86400)/(60*60), -+ (((purb->completion_time).tv_sec%86400)%(60*60)) -+ /60, -+ ((purb->completion_time).tv_sec%86400)%60, -+ (purb->completion_time).tv_usec, -+ dp); -+ -+ al=strlen(a); -+ i=0; -+ if(purb->transfer_buffer != NULL){ -+ for(i=0; -+ (i<4096 && -+ i<(purb->transfer_buffer_length)); -+ i++){ -+ if(purb->transfer_buffer != NULL){ -+ -+ a[al+i+1]= -+ *((char -+ *)purb->transfer_buffer+i); -+ } -+ } -+ } -+ a[al+i+1]=']'; -+ a[al+i+2]='\n'; -+ /*a[al+i+3]='\0';*/ -+ al = al+i+3; -+ -+ if (pos+already_copied < (al+skipped)) { -+ len = (al+skipped)-(pos+already_copied); -+ if ((len+already_copied) >= nbytes){ -+ len = nbytes-already_copied; -+ finished=1; -+ } -+ -+ for(i=0;inext; -+ if(purb == NULL){ -+ finished=1; -+ put_user(-1,buf+already_copied); -+ } -+ } -+ } -+ } -+ -+ *ppos += already_copied; -+ buf += already_copied; -+ nbytes -= already_copied; -+ ret = already_copied; -+ -+err: -+ return ret; -+} -+ -+ -+static ssize_t usbmon_write(struct file *file, char * buf, size_t nbytes, loff_t *ppos) -+{ -+ -+ ssize_t ret = 0; -+ struct usbmon_endpoint_ll *new_endpoint; -+ loff_t pos; -+ char a[255]; -+ struct usb_device *dev; -+ int i=0; -+ -+ pos = *ppos; -+ -+ if (pos < 0) { -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ dev=(struct usb_device *)file->private_data; -+ -+ /*printk("[USBMon] write on device %d, nbytes=%d\n", -+ dev->devnum, nbytes); -+ */ -+ -+ if((nbytes) > 4){ -+ printk("[USBMon] Warning - trying to write more than 4 bytes.pos=%d,nbytes=%d ... continuing\n",(int)pos,(int)nbytes); -+ /*ret=-EINVAL; -+ goto err;*/ -+ } -+ if((nbytes) < 4){ -+ printk("[USBMon] Warning - trying to write less than 4 bytes.pos=%d,nbytes=%d ... ignoring\n",(int)pos,(int)nbytes); -+ ret=-EINVAL; -+ goto err; -+ } -+ -+ for(i=0; i<4 && iUSBMon_data->USBMon_monitored_endpoints; -+ tmp_ep_last=NULL; -+ while(tmp_ep != NULL){ -+ /*printk("[USBMon] checking ep=%8X\n",tmp_ep->value);*/ -+ if(tmp_ep->value==((dev->devnum << 8) | (tmp1 << 15))){ -+ if(a[3]==0){ /*remove it*/ -+ printk("[USBMon]removing monitored endpoint. device=%d, endpoint=%d",dev->devnum, a[1]); -+ if(tmp_ep_last==NULL){ -+ dev->USBMon_data-> -+ USBMon_monitored_endpoints= -+ tmp_ep->next; -+ }else{ -+ tmp_ep_last->next=tmp_ep->next; -+ } -+ kfree(tmp_ep); -+ }else{ -+ tmp_ep->level=a[3]; -+ } -+ tmp_ep=NULL; -+ found=1; -+ }else{ -+ tmp_ep_last=tmp_ep; -+ tmp_ep=tmp_ep->next; -+ } -+ } -+ -+ if(!found){ /* ep doesn't already exist */ -+ new_endpoint = kmalloc(sizeof(struct -+ usbmon_endpoint_ll), -+ GFP_KERNEL); -+ -+ if(new_endpoint != NULL){ -+ -+ new_endpoint->value = ((dev->devnum << 8) | -+ (tmp1 << 15)); -+ printk("[USBMon] Monitoring endpoint %d on device %d, value=%8X, new level=%d \n", tmp1, dev->devnum, new_endpoint->value, a[3]); -+ /*printk("new ep=%8X\n",(int)new_endpoint); -+ */ -+ new_endpoint->level = a[3]; -+ -+ new_endpoint->next = -+ dev->USBMon_data->USBMon_monitored_endpoints; -+ -+ dev->USBMon_data->USBMon_monitored_endpoints = -+ new_endpoint; -+ }else{ -+ ret=-ENOMEM; -+ goto err; -+ } -+ } -+ }else{ -+ printk("[USBMon] Unrecognised Instruction from user on device %d\n", dev->devnum); -+ } -+ -+err: -+ -+ return ret; -+} -+ -+ -+ -+ -+ -+ -+struct file_operations usbdevfs_devicemon_file_operations = { -+ /*llseek: NULL,*/ -+ read: usbmon_read, -+ write: usbmon_write, -+ /*poll: NULL, -+ ioctl: NULL,*/ -+ open: usbmon_open, -+ release: usbmon_release, -+}; -+ -+ -+ -+purb_t USBMon_cpy_urb(urb_t *orig, int level) -+{ -+ urb_t *cpy; -+ -+ cpy = kmalloc(sizeof(*cpy), GFP_ATOMIC); -+ if(!cpy){ -+ printk("[USBMon] Unable to kmalloc URB copy\n"); -+ return NULL; -+ } -+ -+ cpy->dev = orig->dev; -+ cpy->pipe = orig->pipe; -+ cpy->status = orig->status; -+ cpy->transfer_flags = orig->transfer_flags; -+ cpy->transfer_buffer_length = orig->transfer_buffer_length; -+ cpy->actual_length = orig->actual_length; -+ cpy->bandwidth = orig->bandwidth; -+ cpy->setup_packet = orig->setup_packet; -+ cpy->start_frame = orig->start_frame; -+ cpy->number_of_packets = orig->number_of_packets; -+ cpy->interval = orig->interval; -+ cpy->error_count = orig->error_count; -+ -+ get_fast_time(&(cpy->completion_time)); -+ -+ if(level==3){ -+ /*printk("attempting to kmalloc %d bytes\n", -+ orig->transfer_buffer_length);*/ -+ cpy->transfer_buffer = (void *) -+ kmalloc(orig->transfer_buffer_length, -+ GFP_ATOMIC); -+ if(!(cpy->transfer_buffer)){ -+ printk("[USBMon] Unable to kmalloc URB buffer\n"); -+ cpy->transfer_buffer = NULL; -+ }else{ -+ memcpy( cpy->transfer_buffer, -+ orig->transfer_buffer, -+ orig->transfer_buffer_length); -+ } -+ }else{ -+ cpy->transfer_buffer = NULL; -+ } -+ return(cpy); -+} -+ -+ -+void USBMon_urb_pre_completion(urb_t *purb) -+{ -+ urb_t *pcpy_urb; -+ struct usbmon_endpoint_ll *ep; -+ -+ -+ ep = (struct usbmon_endpoint_ll *) -+ purb->dev->USBMon_data->USBMon_monitored_endpoints; -+ -+ -+ while(ep != NULL){ -+ -+ if((purb->pipe & ((0x4f << 8) | (0xf << 15))) == ep->value){ -+ -+ -+ pcpy_urb = USBMon_cpy_urb(purb, ep->level); -+ if(pcpy_urb != NULL){ -+ -+ pcpy_urb->next=NULL; -+ -+ if(purb->dev->USBMon_data->USBMon_urb_ll_head == -+ NULL){ -+ -+ purb->dev->USBMon_data-> -+ USBMon_urb_ll_head = -+ pcpy_urb; -+ purb->dev->USBMon_data-> -+ USBMon_urb_ll_last = -+ pcpy_urb; -+ -+ }else{ -+ purb->dev->USBMon_data-> -+ USBMon_urb_ll_last->next = -+ pcpy_urb; -+ wmb(); -+ purb->dev->USBMon_data-> -+ USBMon_urb_ll_last= -+ pcpy_urb; -+ } -+ -+ }else{ -+ printk("[USBMon] failed to copy URB for monitoring\n"); -+ } -+ -+ ep = NULL; /* So as to break out of while loop faster*/ -+ -+ }else{ /* endif check on endpoint */ -+ -+ ep = ep->next; -+ -+ } -+ } -+} -+ -+/*end USBMon Addition */ -diff -urN -X exclusions linux-2.4.1/drivers/usb/inode.c linux-2.4.1-dev/drivers/usb/inode.c ---- linux-2.4.1/drivers/usb/inode.c Thu Mar 15 22:46:20 2001 -+++ linux-2.4.1-dev/drivers/usb/inode.c Thu Mar 15 22:46:44 2001 -@@ -66,7 +66,7 @@ - const char *name; - unsigned int s; - -- if (dentry->d_name.len != 3) -+ if ((dentry->d_name.len != 3) && (dentry->d_name.len != 4))/*USBMon*/ - return -1; - name = dentry->d_name.name; - if (name[0] < '0' || name[0] > '9' || -@@ -87,6 +87,7 @@ - static void new_dev_inode(struct usb_device *dev, struct super_block *sb) - { - struct inode *inode; -+ struct inode *inode2; /*USBMon Addition*/ - unsigned int devnum = dev->devnum; - unsigned int busnum = dev->bus->busnum; - -@@ -106,6 +107,24 @@ - inode->u.usbdev_i.p.dev = dev; - list_add_tail(&inode->u.usbdev_i.slist, &sb->u.usbdevfs_sb.ilist); - list_add_tail(&inode->u.usbdev_i.dlist, &dev->inodes); -+ -+ /*USBMon Addition */ -+ -+ inode2 = iget(sb, IDEVICEMON | (busnum << 8) | devnum); -+ if (!inode) { -+ printk(KERN_ERR "usbdevfs: cannot create monitor inode for bus %u device %u\n", busnum, devnum); -+ return; -+ } -+ inode2->i_atime = inode2->i_mtime = inode2->i_ctime = CURRENT_TIME; -+ inode2->i_uid = sb->u.usbdevfs_sb.devuid; -+ inode2->i_gid = sb->u.usbdevfs_sb.devgid; -+ inode2->i_mode = sb->u.usbdevfs_sb.devmode | S_IFREG; -+ inode2->i_fop = &usbdevfs_devicemon_file_operations; -+ inode2->i_size = 1024; /*** needs to change */ -+ inode2->u.usbdev_i.p.dev = dev; -+ list_add_tail(&inode2->u.usbdev_i.slist, &sb->u.usbdevfs_sb.ilist); -+ list_add_tail(&inode2->u.usbdev_i.dlist, &dev->inodes); -+ /*end USBMon Addition*/ - } - - static void recurse_new_dev_inode(struct usb_device *dev, struct super_block *sb) -@@ -262,9 +281,15 @@ - return ERR_PTR(-EINVAL); - dentry->d_op = &usbdevfs_dentry_operations; - devnr = dnumber(dentry); -- if (devnr < 1 || devnr > 127) -+ if (devnr < 1 || devnr > 127){ -+ printk("[USBMon] Invalid dev id %d on lookup\n",devnr); - return ERR_PTR(-ENOENT); -- inode = iget(dir->i_sb, IDEVICE | (dir->i_ino & (0xff << 8)) | devnr); -+ } -+ if(dentry->d_name.len == 4){ -+ inode = iget(dir->i_sb, IDEVICEMON | (dir->i_ino & (0xff << 8)) | devnr); -+ }else{ -+ inode = iget(dir->i_sb, IDEVICE | (dir->i_ino & (0xff << 8)) | devnr); -+ } - if (!inode) - return ERR_PTR(-EINVAL); - if (inode && inode->u.usbdev_i.p.dev == NULL) { -@@ -336,17 +361,28 @@ - static int bus_readdir(struct usb_device *dev, unsigned long ino, int pos, struct file *filp, void *dirent, filldir_t filldir) - { - char numbuf[8]; -+ char numbuf2[8]; /*USBMon*/ - unsigned int i; - - if (!dev) - return pos; - sprintf(numbuf, "%03d", dev->devnum); -+ sprintf(numbuf2, "%03dM", dev->devnum);/*USBMon*/ -+ - if (pos > 0) - pos--; - else { -- if (filldir(dirent, numbuf, 3, filp->f_pos, ino | (dev->devnum & 0xff), DT_UNKNOWN) < 0) -+ if (filldir(dirent, numbuf, 3, filp->f_pos, IDEVICE | ino | (dev->devnum & 0xff), DT_UNKNOWN) < 0) - return -1; - filp->f_pos++; -+ -+ /*USBMon Addition*/ -+ if (filldir(dirent, numbuf2, 4, filp->f_pos, IDEVICEMON | ino | (dev->devnum & 0xff), DT_UNKNOWN) < 0){ -+ printk("[USBMon] FAILED to insert monitor file\n"); -+ return -1; -+ } -+ filp->f_pos++; -+ /*USBMon end*/ - } - for (i = 0; i < dev->maxchild; i++) { - if (!dev->children[i]) -@@ -383,7 +419,7 @@ - default: - lock_kernel(); - bus = usbdevfs_findbus(IBUSNR(ino)); -- bus_readdir(bus->root_hub, IDEVICE | ((bus->busnum & 0xff) << 8), filp->f_pos-2, filp, dirent, filldir); -+ bus_readdir(bus->root_hub, ((bus->busnum & 0xff) << 8), filp->f_pos-2, filp, dirent, filldir);/* has changed due to USBMon*/ - unlock_kernel(); - return 0; - } -diff -urN -X exclusions linux-2.4.1/drivers/usb/uhci.c linux-2.4.1-dev/drivers/usb/uhci.c ---- linux-2.4.1/drivers/usb/uhci.c Fri Feb 9 19:30:23 2001 -+++ linux-2.4.1-dev/drivers/usb/uhci.c Wed May 23 00:49:05 2001 -@@ -1426,6 +1426,7 @@ - case PIPE_INTERRUPT: - /* Interrupts are an exception */ - if (urb->interval) { -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete(urb); - uhci_reset_interrupt(urb); - return; -@@ -1455,6 +1456,7 @@ - } - - if (urb->complete && !proceed) { -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete(urb); - if (!proceed && is_ring) - uhci_submit_urb(urb); -@@ -1469,8 +1471,10 @@ - turb = turb->next; - } while (turb && turb != urb->next); - -- if (urb->complete) -+ if (urb->complete){ -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete(urb); -+ } - } - - /* We decrement the usage count after we're done with everything */ -@@ -1563,8 +1567,10 @@ - } else - schedule_timeout(1+1*HZ/1000); - -- if (urb->complete) -+ if (urb->complete){ -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete(urb); -+ } - } - } - -@@ -1717,6 +1723,7 @@ - if ((data > 0) && (uhci->rh.send != 0)) { - dbg("root-hub INT complete: port1: %x port2: %x data: %x", - inw(io_addr + USBPORTSC1), inw(io_addr + USBPORTSC2), data); -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete(urb); - } - -@@ -1740,8 +1747,10 @@ - len = rh_send_irq(urb); - if (len > 0) { - urb->actual_length = len; -- if (urb->complete) -+ if (urb->complete){ -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete(urb); -+ } - } - } - -@@ -1980,8 +1989,10 @@ - - urb->actual_length = len; - urb->status = stat; -- if (urb->complete) -+ if (urb->complete){ -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete(urb); -+ } - - return USB_ST_NOERROR; - } -@@ -2062,8 +2073,10 @@ - - list_del(&urb->urb_list); - -- if (urb->complete) -+ if (urb->complete){ -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete(urb); -+ } - } - spin_unlock(&uhci->urb_remove_lock); - -diff -urN -X exclusions linux-2.4.1/drivers/usb/usb-ohci.c linux-2.4.1-dev/drivers/usb/usb-ohci.c ---- linux-2.4.1/drivers/usb/usb-ohci.c Thu Mar 15 22:46:20 2001 -+++ linux-2.4.1-dev/drivers/usb/usb-ohci.c Thu Mar 15 22:46:44 2001 -@@ -406,6 +406,7 @@ - - switch (usb_pipetype (urb->pipe)) { - case PIPE_INTERRUPT: -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); /* call complete and requeue URB */ - urb->actual_length = 0; - urb->status = USB_ST_URB_PENDING; -@@ -415,7 +416,8 @@ - - case PIPE_ISOCHRONOUS: - for (urbt = urb->next; urbt && (urbt != urb); urbt = urbt->next); -- if (urbt) { /* send the reply and requeue URB */ -+ if (urbt) { /* send the reply and requeue URB */ -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - - spin_lock_irqsave (&usb_ed_lock, flags); -@@ -433,6 +435,7 @@ - - } else { /* unlink URB, call complete */ - urb_rm_priv (urb); -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - } - break; -@@ -440,6 +443,7 @@ - case PIPE_BULK: - case PIPE_CONTROL: /* unlink URB, call complete */ - urb_rm_priv (urb); -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - break; - } -@@ -670,6 +674,8 @@ - if (urb->transfer_flags & USB_ASYNC_UNLINK) { - urb->status = -ECONNRESET; - if (urb->complete) -+ USBMon_urb_pre_completion(urb); -+ /*USBMon*/ - urb->complete (urb); - } else - urb->status = -ENOENT; -@@ -1336,6 +1342,7 @@ - if (urb->transfer_flags & USB_ASYNC_UNLINK) { - urb->status = -ECONNRESET; - if (urb->complete) -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - } else { - urb->status = -ENOENT; -@@ -1694,6 +1701,7 @@ - urb_print (urb, "RET-t(rh)", usb_pipeout (urb->pipe)); - #endif - if (urb->complete) -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - } - } -@@ -1924,6 +1932,7 @@ - usb_dec_dev_use (usb_dev); - urb->dev = NULL; - if (urb->complete) -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - return 0; - } -@@ -1945,6 +1954,7 @@ - if (urb->transfer_flags & USB_ASYNC_UNLINK) { - urb->status = -ECONNRESET; - if (urb->complete) -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - } else - urb->status = -ENOENT; -diff -urN -X exclusions linux-2.4.1/drivers/usb/usb-uhci.c linux-2.4.1-dev/drivers/usb/usb-uhci.c ---- linux-2.4.1/drivers/usb/usb-uhci.c Thu Mar 15 22:46:21 2001 -+++ linux-2.4.1-dev/drivers/usb/usb-uhci.c Thu Mar 15 22:46:44 2001 -@@ -1141,6 +1141,7 @@ - usb_dev = urb->dev; - if (urb->complete) { - dbg("unlink_urb: calling completion"); -+ USBMon_urb_pre_completion(urb); /*USBMon*/ - urb->dev = NULL; - urb->complete ((struct urb *) urb); - } -@@ -1208,6 +1209,7 @@ - - if (urb->complete) { - spin_unlock(&s->urb_list_lock); -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->dev = NULL; - urb->complete ((struct urb *) urb); - spin_lock(&s->urb_list_lock); -@@ -1868,6 +1870,7 @@ - if ((data > 0) && (uhci->rh.send != 0)) { - dbg("Root-Hub INT complete: port1: %x port2: %x data: %x", - inw (io_addr + USBPORTSC1), inw (io_addr + USBPORTSC2), data); -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - } - return 0; -@@ -1887,8 +1890,10 @@ - len = rh_send_irq (urb); - if (len > 0) { - urb->actual_length = len; -- if (urb->complete) -+ if (urb->complete){ -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); -+ } - } - } - rh_init_int_timer (urb); -@@ -2121,9 +2126,12 @@ - - urb->actual_length = len; - urb->status = stat; -- urb->dev=NULL; -- if (urb->complete) -+ /*urb->dev=NULL; commented out for USBMon*/ -+ if (urb->complete){ -+ USBMon_urb_pre_completion(urb);/*USBMon*/ -+ urb->dev=NULL;/*USBMon*/ - urb->complete (urb); -+ } - return 0; - } - /*-------------------------------------------------------------------------*/ -@@ -2407,6 +2415,8 @@ - - spin_unlock(&s->urb_list_lock); - -+ USBMon_urb_pre_completion(urb);/*USBMon*/ -+ - urb->complete ((struct urb *) urb); - - spin_lock(&s->urb_list_lock); -@@ -2625,6 +2635,7 @@ - - // Completion - if (urb->complete) { -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->dev = NULL; - spin_unlock(&s->urb_list_lock); - urb->complete ((struct urb *) urb); -diff -urN -X exclusions linux-2.4.1/drivers/usb/usb.c linux-2.4.1-dev/drivers/usb/usb.c ---- linux-2.4.1/drivers/usb/usb.c Thu Mar 15 22:46:21 2001 -+++ linux-2.4.1-dev/drivers/usb/usb.c Fri Mar 16 17:08:17 2001 -@@ -256,7 +256,8 @@ - /* - * usb_check_bandwidth(): - * -- * old_alloc is from host_controller->bandwidth_allocated in microseconds; -+ * old_ -+ is from host_controller->bandwidth_allocated in microseconds; - * bustime is from calc_bus_time(), but converted to microseconds. - * - * returns if successful, -@@ -885,6 +886,15 @@ - INIT_LIST_HEAD(&dev->inodes); - INIT_LIST_HEAD(&dev->filelist); - -+ dev->USBMon_data = kmalloc(sizeof(struct USBMon_data), GFP_KERNEL); -+ if(dev->USBMon_data == NULL){ -+ return(NULL); -+ } -+ dev->USBMon_data->USBMon_urb_ll_head = NULL;/*USBMon*/ -+ dev->USBMon_data->USBMon_urb_ll_last = NULL;/*USBMon*/ -+ dev->USBMon_data->USBMon_urb_ll_buffered = NULL;/*USBMon*/ -+ dev->USBMon_data->USBMon_monitored_endpoints = NULL;/*USBMon*/ -+ - dev->bus->op->allocate(dev); - - return dev; -@@ -892,7 +902,22 @@ - - void usb_free_dev(struct usb_device *dev) - { -+ /*USBMon*/ -+ struct usbmon_endpoint_ll *tmp_ep1,*tmp_ep2; -+ /* -+ tmp_ep1=dev->USBMon_data->USBMon_monitored_endpoints; -+ while(tmp_ep1 != NULL){ -+ tmp_ep2=tmp_ep1->next; -+ kfree(tmp_ep1); -+ tmp_ep1=tmp_ep2; -+ } -+ kfree(dev->USBMon_data); -+ /*end USBMon*/ -+ -+ - if (atomic_dec_and_test(&dev->refcnt)) { -+ -+ - dev->bus->op->deallocate(dev); - usb_destroy_configuration(dev); - kfree(dev); -diff -urN -X exclusions linux-2.4.1/include/linux/usb.h linux-2.4.1-dev/include/linux/usb.h ---- linux-2.4.1/include/linux/usb.h Thu Mar 15 22:46:21 2001 -+++ linux-2.4.1-dev/include/linux/usb.h Mon May 14 15:46:24 2001 -@@ -135,6 +135,7 @@ - #include /* for in_interrupt() */ - #include - #include -+#include /* for USBMon */ - - #define USB_MAJOR 180 - -@@ -463,6 +464,8 @@ - usb_complete_t complete; // pointer to completion routine - // - iso_packet_descriptor_t iso_frame_desc[0]; -+ // -+ struct timeval completion_time; // for USBMon timestamping - } urb_t, *purb_t; - - #define FILL_CONTROL_URB(a,aa,b,c,d,e,f,g) \ -@@ -580,6 +583,22 @@ - }; - - #define USB_MAXCHILDREN (16) /* This is arbitrary */ -+/* -+struct usbmon_endpoint_ll; -+*/ -+struct usbmon_endpoint_ll { -+ unsigned int value; -+ struct usbmon_endpoint_ll *next; -+ int level; -+}; -+ -+struct USBMon_data { -+ struct usbmon_endpoint_ll *USBMon_monitored_endpoints; /*USBMon*/ -+ urb_t *USBMon_urb_ll_head;/*USBMon*/ -+ urb_t *USBMon_urb_ll_last;/*USBMon*/ -+ urb_t *USBMon_urb_ll_buffered;/*USBMon*/ -+ unsigned char USBMon_write_buffer[4]; -+}; - - struct usb_device { - int devnum; /* Device number on USB bus */ -@@ -621,6 +640,7 @@ - - int maxchild; /* Number of ports if hub */ - struct usb_device *children[USB_MAXCHILDREN]; -+ struct USBMon_data *USBMon_data; - }; - - extern struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, unsigned ifnum); -diff -urN -X exclusions linux-2.4.1/include/linux/usbdevice_fs.h linux-2.4.1-dev/include/linux/usbdevice_fs.h ---- linux-2.4.1/include/linux/usbdevice_fs.h Thu Mar 15 22:46:21 2001 -+++ linux-2.4.1-dev/include/linux/usbdevice_fs.h Thu Mar 15 22:46:44 2001 -@@ -157,6 +157,7 @@ - #define ISPECIAL (0<<28) - #define IBUS (1<<28) - #define IDEVICE (2<<28) -+#define IDEVICEMON (4<<28) /*USBMon Addition */ - #define IBUSNR(x) (((x)>>8)&0xff) - #define IDEVNR(x) ((x)&0xff) - -@@ -193,7 +194,8 @@ - extern struct usb_driver usbdevfs_driver; - extern struct file_operations usbdevfs_drivers_fops; - extern struct file_operations usbdevfs_devices_fops; --extern struct file_operations usbdevfs_device_file_operations; -+extern struct file_operations usbdevfs_devicemon_file_operations; -+extern struct file_operations usbdevfs_device_file_operations; /*USBMon*/ - extern struct inode_operations usbdevfs_device_inode_operations; - extern struct inode_operations usbdevfs_bus_inode_operations; - extern struct file_operations usbdevfs_bus_file_operations; diff -urN -X dontdiffjava USBMon-0.2a/USBMon_0.2_kernel_2.4.4.diff USBMon-0.3/USBMon_0.2_kernel_2.4.4.diff --- USBMon-0.2a/USBMon_0.2_kernel_2.4.4.diff 2001-06-01 09:05:25.000000000 -0700 +++ USBMon-0.3/USBMon_0.2_kernel_2.4.4.diff 1969-12-31 16:00:00.000000000 -0800 @@ -1,839 +0,0 @@ -diff -urN -X exclusions linux/drivers/usb/devio.c linux-2.4.4-dev/drivers/usb/devio.c ---- linux/drivers/usb/devio.c Fri Apr 6 23:51:50 2001 -+++ linux-2.4.4-dev/drivers/usb/devio.c Fri Jun 1 14:56:26 2001 -@@ -43,6 +43,7 @@ - #include - #include - #include -+#include /*for USBMon*/ - - - struct async { -@@ -57,6 +58,7 @@ - - static loff_t usbdev_lseek(struct file *file, loff_t offset, int orig) - { -+ printk("usbdev_lseek called.\n"); - switch (orig) { - case 0: - file->f_pos = offset; -@@ -1211,3 +1213,426 @@ - open: usbdev_open, - release: usbdev_release, - }; -+ -+ -+/*************************** USBMon Addition *********************************/ -+ -+ -+static int usbmon_open(struct inode *inode, struct file *file) -+{ -+ struct usb_device *dev; -+ int ret; -+ -+ /*printk("[USBMon] usbmon_open called with inode=&%X\n",inode);*/ -+ -+ lock_kernel(); -+ ret = -ENOENT; -+ if (ITYPE(inode->i_ino) != IDEVICEMON) -+ goto out; -+ dev = inode->u.usbdev_i.p.dev; -+ if (!dev) -+ goto out; -+ -+ ret = 0; -+ -+ dev->USBMon_data->USBMon_urb_ll_buffered = -+ dev->USBMon_data->USBMon_urb_ll_head; -+ wmb(); -+ dev->USBMon_data->USBMon_urb_ll_head = NULL; -+ wmb(); -+ dev->USBMon_data->USBMon_urb_ll_last = NULL; -+ wmb(); -+ -+ file->private_data = dev; -+ out: -+ unlock_kernel(); -+ return ret; -+} -+ -+static int usbmon_release(struct inode *inode, struct file *file) -+{ -+ urb_t *temp_urb1, *temp_urb2; -+ struct usb_device *dev; -+ -+ dev = (struct usb_device *)(file->private_data); -+ -+ temp_urb1=dev->USBMon_data->USBMon_urb_ll_buffered; -+ -+ wmb(); -+ -+ dev->USBMon_data->USBMon_urb_ll_buffered=NULL; -+ -+ -+ while(temp_urb1 != NULL){ -+ temp_urb2 = temp_urb1; -+ if(temp_urb1->transfer_buffer){ -+ kfree(temp_urb1->transfer_buffer); -+ } -+ temp_urb1=temp_urb1->next; -+ kfree(temp_urb2); -+ } -+ return 0; -+} -+ -+static ssize_t usbmon_read(struct file *file, char * buf, size_t nbytes, loff_t *ppos) -+{ -+ ssize_t ret = 0; -+ unsigned int len=0; -+ unsigned int already_copied=0; -+ unsigned int skipped=0; -+ int i; -+ loff_t pos; -+ char a[5120]; -+ char b[10]; -+ struct usb_device *dev; -+ urb_t *purb; -+ int finished=0; -+ -+ pos = *ppos; -+ -+ if (!file->private_data) { -+ ret = -ENODEV; -+ goto err; -+ } else if (pos < 0) { -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ dev=(struct usb_device *)file->private_data; -+ -+ /*printk("[USBMon] read on device %d, buffered=%8X\n", -+ dev->devnum, -+ dev->USBMon_data->USBMon_urb_ll_buffered); -+ */ -+ -+ purb = dev->USBMon_data->USBMon_urb_ll_buffered; -+ -+ if(purb == NULL){ -+ finished=1; -+ } -+ while(finished == 0){ -+ { -+ int dp=0, al=0; -+ if(purb->transfer_buffer == NULL){ -+ dp=0; -+ }else{ -+ dp=1; -+ } -+ sprintf(a,"[URB completed on Device=%03d, " -+ "Endpoint=%02d, Pipe=%08X, " -+ "status= % 03d, size= %08d, transfer_flags = " -+ "%08X, actual_length = %08d, " -+ "error count = %05d completion_time = %02d" -+ ":%02d:%02d:%06d dp=%d data=", -+ purb->dev->devnum, -+ (purb->pipe & (0xf <<15))>>15, -+ purb->pipe, -+ purb->status, -+ purb->transfer_buffer_length, -+ purb->transfer_flags, -+ purb->actual_length, -+ purb->error_count, -+ -+ ((purb->completion_time).tv_sec%86400)/(60*60), -+ (((purb->completion_time).tv_sec%86400)%(60*60)) -+ /60, -+ ((purb->completion_time).tv_sec%86400)%60, -+ (purb->completion_time).tv_usec, -+ dp); -+ -+ al=strlen(a); -+ i=0; -+ if(purb->transfer_buffer != NULL){ -+ for(i=0; -+ (i<4096 && -+ i<(purb->transfer_buffer_length)); -+ i++){ -+ if(purb->transfer_buffer != NULL){ -+ -+ a[al+i+1]= -+ *((char -+ *)purb->transfer_buffer+i); -+ } -+ } -+ } -+ a[al+i+1]=']'; -+ a[al+i+2]='\n'; -+ /*a[al+i+3]='\0';*/ -+ al = al+i+3; -+ -+ if (pos+already_copied < (al+skipped)) { -+ len = (al+skipped)-(pos+already_copied); -+ if ((len+already_copied) >= nbytes){ -+ len = nbytes-already_copied; -+ finished=1; -+ } -+ -+ for(i=0;inext; -+ if(purb == NULL){ -+ finished=1; -+ put_user(-1,buf+already_copied); -+ } -+ } -+ } -+ } -+ -+ *ppos += already_copied; -+ buf += already_copied; -+ nbytes -= already_copied; -+ ret = already_copied; -+ -+err: -+ return ret; -+} -+ -+ -+static ssize_t usbmon_write(struct file *file, char * buf, size_t nbytes, loff_t *ppos) -+{ -+ -+ ssize_t ret = 0; -+ struct usbmon_endpoint_ll *new_endpoint; -+ loff_t pos; -+ char a[255]; -+ struct usb_device *dev; -+ int i=0; -+ -+ pos = *ppos; -+ -+ if (pos < 0) { -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ dev=(struct usb_device *)file->private_data; -+ -+ /*printk("[USBMon] write on device %d, nbytes=%d\n", -+ dev->devnum, nbytes); -+ */ -+ -+ if((nbytes) > 4){ -+ printk("[USBMon] Warning - trying to write more than 4 bytes.pos=%d,nbytes=%d ... continuing\n",(int)pos,(int)nbytes); -+ /*ret=-EINVAL; -+ goto err;*/ -+ } -+ if((nbytes) < 4){ -+ printk("[USBMon] Warning - trying to write less than 4 bytes.pos=%d,nbytes=%d ... ignoring\n",(int)pos,(int)nbytes); -+ ret=-EINVAL; -+ goto err; -+ } -+ -+ for(i=0; i<4 && iUSBMon_data->USBMon_monitored_endpoints; -+ tmp_ep_last=NULL; -+ while(tmp_ep != NULL){ -+ /*printk("[USBMon] checking ep=%8X\n",tmp_ep->value);*/ -+ if(tmp_ep->value==((dev->devnum << 8) | (tmp1 << 15))){ -+ if(a[3]==0){ /*remove it*/ -+ printk("[USBMon]removing monitored endpoint. device=%d, endpoint=%d",dev->devnum, a[1]); -+ if(tmp_ep_last==NULL){ -+ dev->USBMon_data-> -+ USBMon_monitored_endpoints= -+ tmp_ep->next; -+ }else{ -+ tmp_ep_last->next=tmp_ep->next; -+ } -+ kfree(tmp_ep); -+ }else{ -+ tmp_ep->level=a[3]; -+ } -+ tmp_ep=NULL; -+ found=1; -+ }else{ -+ tmp_ep_last=tmp_ep; -+ tmp_ep=tmp_ep->next; -+ } -+ } -+ -+ if(!found){ /* ep doesn't already exist */ -+ new_endpoint = kmalloc(sizeof(struct -+ usbmon_endpoint_ll), -+ GFP_KERNEL); -+ -+ if(new_endpoint != NULL){ -+ -+ new_endpoint->value = ((dev->devnum << 8) | -+ (tmp1 << 15)); -+ printk("[USBMon] Monitoring endpoint %d on device %d, value=%8X, new level=%d \n", tmp1, dev->devnum, new_endpoint->value, a[3]); -+ /*printk("new ep=%8X\n",(int)new_endpoint); -+ */ -+ new_endpoint->level = a[3]; -+ -+ new_endpoint->next = -+ dev->USBMon_data->USBMon_monitored_endpoints; -+ -+ dev->USBMon_data->USBMon_monitored_endpoints = -+ new_endpoint; -+ }else{ -+ ret=-ENOMEM; -+ goto err; -+ } -+ } -+ }else{ -+ printk("[USBMon] Unrecognised Instruction from user on device %d\n", dev->devnum); -+ } -+ -+err: -+ -+ return ret; -+} -+ -+ -+ -+ -+ -+ -+struct file_operations usbdevfs_devicemon_file_operations = { -+ /*llseek: NULL,*/ -+ read: usbmon_read, -+ write: usbmon_write, -+ /*poll: NULL, -+ ioctl: NULL,*/ -+ open: usbmon_open, -+ release: usbmon_release, -+}; -+ -+ -+ -+purb_t USBMon_cpy_urb(urb_t *orig, int level) -+{ -+ urb_t *cpy; -+ -+ cpy = kmalloc(sizeof(*cpy), GFP_ATOMIC); -+ if(!cpy){ -+ printk("[USBMon] Unable to kmalloc URB copy\n"); -+ return NULL; -+ } -+ -+ cpy->dev = orig->dev; -+ cpy->pipe = orig->pipe; -+ cpy->status = orig->status; -+ cpy->transfer_flags = orig->transfer_flags; -+ cpy->transfer_buffer_length = orig->transfer_buffer_length; -+ cpy->actual_length = orig->actual_length; -+ cpy->bandwidth = orig->bandwidth; -+ cpy->setup_packet = orig->setup_packet; -+ cpy->start_frame = orig->start_frame; -+ cpy->number_of_packets = orig->number_of_packets; -+ cpy->interval = orig->interval; -+ cpy->error_count = orig->error_count; -+ -+ get_fast_time(&(cpy->completion_time)); -+ -+ if(level==3){ -+ /*printk("attempting to kmalloc %d bytes\n", -+ orig->transfer_buffer_length);*/ -+ cpy->transfer_buffer = (void *) -+ kmalloc(orig->transfer_buffer_length, -+ GFP_ATOMIC); -+ if(!(cpy->transfer_buffer)){ -+ printk("[USBMon] Unable to kmalloc URB buffer\n"); -+ cpy->transfer_buffer = NULL; -+ }else{ -+ memcpy( cpy->transfer_buffer, -+ orig->transfer_buffer, -+ orig->transfer_buffer_length); -+ } -+ }else{ -+ cpy->transfer_buffer = NULL; -+ } -+ return(cpy); -+} -+ -+ -+void USBMon_urb_pre_completion(urb_t *purb) -+{ -+ urb_t *pcpy_urb; -+ struct usbmon_endpoint_ll *ep; -+ int a=0; -+ -+ if(purb->dev !=NULL){ -+ if(purb->dev->USBMon_data != NULL){ -+ -+ ep = (struct usbmon_endpoint_ll *) -+ purb->dev->USBMon_data->USBMon_monitored_endpoints; -+ -+ }else{ -+ printk("[USBMON] -special- " -+ "USBMon_data is NULL, device number=%d\n", -+ purb->dev->devnum); -+ return; -+ } -+ }else{ -+ printk("[USBMON] -special- " -+ "device pointer is NULL\n"); -+ return; -+ } -+ -+ while(ep != NULL){ -+ a++; -+ -+ if((purb->pipe & ((0x4f << 8) | (0xf << 15))) == ep->value){ -+ -+ a=a+1000; -+ pcpy_urb = USBMon_cpy_urb(purb, ep->level); -+ if(pcpy_urb != NULL){ -+ -+ pcpy_urb->next=NULL; -+ -+ if(purb->dev->USBMon_data->USBMon_urb_ll_head == -+ NULL){ -+ -+ purb->dev->USBMon_data-> -+ USBMon_urb_ll_head = -+ pcpy_urb; -+ purb->dev->USBMon_data-> -+ USBMon_urb_ll_last = -+ pcpy_urb; -+ -+ }else{ -+ purb->dev->USBMon_data-> -+ USBMon_urb_ll_last->next = -+ pcpy_urb; -+ wmb(); -+ purb->dev->USBMon_data-> -+ USBMon_urb_ll_last= -+ pcpy_urb; -+ } -+ -+ }else{ -+ printk("[USBMon] failed to copy URB for monitoring\n"); -+ } -+ -+ ep = NULL; /* So as to break out of while loop faster*/ -+ -+ }else{ /* endif check on endpoint */ -+ -+ ep = ep->next; -+ -+ } -+ } -+ -+} -+ -+/*end USBMon Addition */ -diff -urN -X exclusions linux/drivers/usb/inode.c linux-2.4.4-dev/drivers/usb/inode.c ---- linux/drivers/usb/inode.c Fri Mar 2 21:47:21 2001 -+++ linux-2.4.4-dev/drivers/usb/inode.c Tue May 22 23:57:35 2001 -@@ -66,7 +66,7 @@ - const char *name; - unsigned int s; - -- if (dentry->d_name.len != 3) -+ if ((dentry->d_name.len != 3) && (dentry->d_name.len != 4))/*USBMon*/ - return -1; - name = dentry->d_name.name; - if (name[0] < '0' || name[0] > '9' || -@@ -87,6 +87,7 @@ - static void new_dev_inode(struct usb_device *dev, struct super_block *sb) - { - struct inode *inode; -+ struct inode *inode2; /*USBMon Addition*/ - unsigned int devnum = dev->devnum; - unsigned int busnum = dev->bus->busnum; - -@@ -106,6 +107,24 @@ - inode->u.usbdev_i.p.dev = dev; - list_add_tail(&inode->u.usbdev_i.slist, &sb->u.usbdevfs_sb.ilist); - list_add_tail(&inode->u.usbdev_i.dlist, &dev->inodes); -+ -+ /*USBMon Addition */ -+ -+ inode2 = iget(sb, IDEVICEMON | (busnum << 8) | devnum); -+ if (!inode) { -+ printk(KERN_ERR "usbdevfs: cannot create monitor inode for bus %u device %u\n", busnum, devnum); -+ return; -+ } -+ inode2->i_atime = inode2->i_mtime = inode2->i_ctime = CURRENT_TIME; -+ inode2->i_uid = sb->u.usbdevfs_sb.devuid; -+ inode2->i_gid = sb->u.usbdevfs_sb.devgid; -+ inode2->i_mode = sb->u.usbdevfs_sb.devmode | S_IFREG; -+ inode2->i_fop = &usbdevfs_devicemon_file_operations; -+ inode2->i_size = 1024; /*** needs to change */ -+ inode2->u.usbdev_i.p.dev = dev; -+ list_add_tail(&inode2->u.usbdev_i.slist, &sb->u.usbdevfs_sb.ilist); -+ list_add_tail(&inode2->u.usbdev_i.dlist, &dev->inodes); -+ /*end USBMon Addition*/ - } - - static void recurse_new_dev_inode(struct usb_device *dev, struct super_block *sb) -@@ -262,9 +281,15 @@ - return ERR_PTR(-EINVAL); - dentry->d_op = &usbdevfs_dentry_operations; - devnr = dnumber(dentry); -- if (devnr < 1 || devnr > 127) -+ if (devnr < 1 || devnr > 127){ -+ printk("[USBMon] Invalid dev id %d on lookup\n",devnr); - return ERR_PTR(-ENOENT); -- inode = iget(dir->i_sb, IDEVICE | (dir->i_ino & (0xff << 8)) | devnr); -+ } -+ if(dentry->d_name.len == 4){ -+ inode = iget(dir->i_sb, IDEVICEMON | (dir->i_ino & (0xff << 8)) | devnr); -+ }else{ -+ inode = iget(dir->i_sb, IDEVICE | (dir->i_ino & (0xff << 8)) | devnr); -+ } - if (!inode) - return ERR_PTR(-EINVAL); - if (inode && inode->u.usbdev_i.p.dev == NULL) { -@@ -336,17 +361,28 @@ - static int bus_readdir(struct usb_device *dev, unsigned long ino, int pos, struct file *filp, void *dirent, filldir_t filldir) - { - char numbuf[8]; -+ char numbuf2[8]; /*USBMon*/ - unsigned int i; - - if (!dev) - return pos; - sprintf(numbuf, "%03d", dev->devnum); -+ sprintf(numbuf2, "%03dM", dev->devnum);/*USBMon*/ -+ - if (pos > 0) - pos--; - else { -- if (filldir(dirent, numbuf, 3, filp->f_pos, ino | (dev->devnum & 0xff), DT_UNKNOWN) < 0) -+ if (filldir(dirent, numbuf, 3, filp->f_pos, IDEVICE | ino | (dev->devnum & 0xff), DT_UNKNOWN) < 0) - return -1; - filp->f_pos++; -+ -+ /*USBMon Addition*/ -+ if (filldir(dirent, numbuf2, 4, filp->f_pos, IDEVICEMON | ino | (dev->devnum & 0xff), DT_UNKNOWN) < 0){ -+ printk("[USBMon] FAILED to insert monitor file\n"); -+ return -1; -+ } -+ filp->f_pos++; -+ /*USBMon end*/ - } - for (i = 0; i < dev->maxchild; i++) { - if (!dev->children[i]) -@@ -383,7 +419,7 @@ - default: - lock_kernel(); - bus = usbdevfs_findbus(IBUSNR(ino)); -- bus_readdir(bus->root_hub, IDEVICE | ((bus->busnum & 0xff) << 8), filp->f_pos-2, filp, dirent, filldir); -+ bus_readdir(bus->root_hub, ((bus->busnum & 0xff) << 8), filp->f_pos-2, filp, dirent, filldir);/* has changed due to USBMon*/ - unlock_kernel(); - return 0; - } -diff -urN -X exclusions linux/drivers/usb/uhci.c linux-2.4.4-dev/drivers/usb/uhci.c ---- linux/drivers/usb/uhci.c Wed Apr 25 22:10:49 2001 -+++ linux-2.4.4-dev/drivers/usb/uhci.c Wed May 23 00:41:39 2001 -@@ -2256,9 +2256,14 @@ - pci_dma_sync_single(uhci->dev, urbp->setup_packet_dma_handle, - sizeof(devrequest), PCI_DMA_TODEVICE); - -- urb->dev = NULL; -- if (urb->complete) -+ /*urb->dev = NULL;*/ -+ if (urb->complete){ -+ USBMon_urb_pre_completion(urb);/*USBMon*/ -+ urb->dev = NULL; - urb->complete(urb); -+ }else{ -+ urb->dev = NULL; -+ } - - if (resubmit_interrupt) { - urb->dev = dev; -diff -urN -X exclusions linux/drivers/usb/usb-ohci.c linux-2.4.4-dev/drivers/usb/usb-ohci.c ---- linux/drivers/usb/usb-ohci.c Wed Apr 25 22:10:49 2001 -+++ linux-2.4.4-dev/drivers/usb/usb-ohci.c Wed May 23 00:14:35 2001 -@@ -464,6 +464,7 @@ - usb_pipeout (urb->pipe) - ? PCI_DMA_TODEVICE - : PCI_DMA_FROMDEVICE); -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - - /* implicitly requeued */ -@@ -482,6 +483,7 @@ - usb_pipeout (urb->pipe) - ? PCI_DMA_TODEVICE - : PCI_DMA_FROMDEVICE); -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - spin_lock_irqsave (&usb_ed_lock, flags); - urb->actual_length = 0; -@@ -498,6 +500,7 @@ - - } else { /* unlink URB, call complete */ - urb_rm_priv (urb); -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - } - break; -@@ -505,6 +508,7 @@ - case PIPE_BULK: - case PIPE_CONTROL: /* unlink URB, call complete */ - urb_rm_priv (urb); -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - break; - } -@@ -765,6 +769,8 @@ - if (urb->transfer_flags & USB_ASYNC_UNLINK) { - urb->status = -ECONNRESET; - if (urb->complete) -+ USBMon_urb_pre_completion(urb); -+ /*USBMon*/ - urb->complete (urb); - } else - urb->status = -ENOENT; -@@ -1456,6 +1462,7 @@ - if (urb->transfer_flags & USB_ASYNC_UNLINK) { - urb->status = -ECONNRESET; - if (urb->complete) -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - } else { - urb->status = -ENOENT; -@@ -1816,6 +1823,7 @@ - urb_print (urb, "RET-t(rh)", usb_pipeout (urb->pipe)); - #endif - if (urb->complete) -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - } - } -@@ -2043,6 +2051,7 @@ - usb_dec_dev_use (usb_dev); - urb->dev = NULL; - if (urb->complete) -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - return 0; - } -@@ -2064,6 +2073,7 @@ - if (urb->transfer_flags & USB_ASYNC_UNLINK) { - urb->status = -ECONNRESET; - if (urb->complete) -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - } else - urb->status = -ENOENT; -diff -urN -X exclusions linux/drivers/usb/usb-uhci.c linux-2.4.4-dev/drivers/usb/usb-uhci.c ---- linux/drivers/usb/usb-uhci.c Fri Apr 27 23:13:07 2001 -+++ linux-2.4.4-dev/drivers/usb/usb-uhci.c Wed May 23 00:04:56 2001 -@@ -1141,6 +1141,7 @@ - usb_dev = urb->dev; - if (urb->complete) { - dbg("unlink_urb: calling completion"); -+ USBMon_urb_pre_completion(urb); /*USBMon*/ - urb->dev = NULL; - urb->complete ((struct urb *) urb); - } -@@ -1212,6 +1213,7 @@ - - if (urb->complete) { - spin_unlock(&s->urb_list_lock); -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->dev = NULL; - urb->complete ((struct urb *) urb); - spin_lock(&s->urb_list_lock); -@@ -1871,6 +1873,7 @@ - if ((data > 0) && (uhci->rh.send != 0)) { - dbg("Root-Hub INT complete: port1: %x port2: %x data: %x", - inw (io_addr + USBPORTSC1), inw (io_addr + USBPORTSC2), data); -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); - } - return 0; -@@ -1890,8 +1893,10 @@ - len = rh_send_irq (urb); - if (len > 0) { - urb->actual_length = len; -- if (urb->complete) -+ if (urb->complete){ -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->complete (urb); -+ } - } - } - rh_init_int_timer (urb); -@@ -2124,9 +2129,12 @@ - - urb->actual_length = len; - urb->status = stat; -- urb->dev=NULL; -- if (urb->complete) -+ /*urb->dev=NULL; commented out for USBMon*/ -+ if (urb->complete){ -+ USBMon_urb_pre_completion(urb);/*USBMon*/ -+ urb->dev=NULL;/*USBMon*/ - urb->complete (urb); -+ } - return 0; - } - /*-------------------------------------------------------------------------*/ -@@ -2413,6 +2421,8 @@ - - spin_unlock(&s->urb_list_lock); - -+ USBMon_urb_pre_completion(urb);/*USBMon*/ -+ - urb->complete ((struct urb *) urb); - - spin_lock(&s->urb_list_lock); -@@ -2632,6 +2642,7 @@ - // Completion - if (urb->complete) { - int was_unlinked = (urb->status == -ENOENT); -+ USBMon_urb_pre_completion(urb);/*USBMon*/ - urb->dev = NULL; - spin_unlock(&s->urb_list_lock); - urb->complete ((struct urb *) urb); -diff -urN -X exclusions linux/drivers/usb/usb.c linux-2.4.4-dev/drivers/usb/usb.c ---- linux/drivers/usb/usb.c Wed Apr 25 22:10:47 2001 -+++ linux-2.4.4-dev/drivers/usb/usb.c Tue May 22 23:57:35 2001 -@@ -251,7 +251,8 @@ - /* - * usb_check_bandwidth(): - * -- * old_alloc is from host_controller->bandwidth_allocated in microseconds; -+ * old_ -+ is from host_controller->bandwidth_allocated in microseconds; - * bustime is from calc_bus_time(), but converted to microseconds. - * - * returns if successful, -@@ -925,6 +926,15 @@ - INIT_LIST_HEAD(&dev->inodes); - INIT_LIST_HEAD(&dev->filelist); - -+ dev->USBMon_data = kmalloc(sizeof(struct USBMon_data), GFP_KERNEL); -+ if(dev->USBMon_data == NULL){ -+ return(NULL); -+ } -+ dev->USBMon_data->USBMon_urb_ll_head = NULL;/*USBMon*/ -+ dev->USBMon_data->USBMon_urb_ll_last = NULL;/*USBMon*/ -+ dev->USBMon_data->USBMon_urb_ll_buffered = NULL;/*USBMon*/ -+ dev->USBMon_data->USBMon_monitored_endpoints = NULL;/*USBMon*/ -+ - dev->bus->op->allocate(dev); - - return dev; -@@ -932,7 +942,22 @@ - - void usb_free_dev(struct usb_device *dev) - { -+ /*USBMon*/ -+ struct usbmon_endpoint_ll *tmp_ep1,*tmp_ep2; -+ /* -+ tmp_ep1=dev->USBMon_data->USBMon_monitored_endpoints; -+ while(tmp_ep1 != NULL){ -+ tmp_ep2=tmp_ep1->next; -+ kfree(tmp_ep1); -+ tmp_ep1=tmp_ep2; -+ } -+ kfree(dev->USBMon_data); -+ /*end USBMon*/ -+ -+ - if (atomic_dec_and_test(&dev->refcnt)) { -+ -+ - dev->bus->op->deallocate(dev); - usb_destroy_configuration(dev); - -diff -urN -X exclusions linux/include/linux/usb.h linux-2.4.4-dev/include/linux/usb.h ---- linux/include/linux/usb.h Fri Apr 27 23:49:27 2001 -+++ linux-2.4.4-dev/include/linux/usb.h Tue May 22 23:57:35 2001 -@@ -135,6 +135,7 @@ - #include /* for in_interrupt() */ - #include - #include -+#include /* for USBMon */ - - #define USB_MAJOR 180 - -@@ -464,6 +465,8 @@ - usb_complete_t complete; // pointer to completion routine - // - iso_packet_descriptor_t iso_frame_desc[0]; -+ // -+ struct timeval completion_time; // for USBMon timestamping - } urb_t, *purb_t; - - #define FILL_CONTROL_URB(a,aa,b,c,d,e,f,g) \ -@@ -589,6 +592,22 @@ - }; - - #define USB_MAXCHILDREN (16) /* This is arbitrary */ -+/* -+struct usbmon_endpoint_ll; -+*/ -+struct usbmon_endpoint_ll { -+ unsigned int value; -+ struct usbmon_endpoint_ll *next; -+ int level; -+}; -+ -+struct USBMon_data { -+ struct usbmon_endpoint_ll *USBMon_monitored_endpoints; /*USBMon*/ -+ urb_t *USBMon_urb_ll_head;/*USBMon*/ -+ urb_t *USBMon_urb_ll_last;/*USBMon*/ -+ urb_t *USBMon_urb_ll_buffered;/*USBMon*/ -+ unsigned char USBMon_write_buffer[4]; -+}; - - struct usb_device { - int devnum; /* Device number on USB bus */ -@@ -630,6 +649,7 @@ - - int maxchild; /* Number of ports if hub */ - struct usb_device *children[USB_MAXCHILDREN]; -+ struct USBMon_data *USBMon_data; - }; - - extern struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, unsigned ifnum); -diff -urN -X exclusions linux/include/linux/usbdevice_fs.h linux-2.4.4-dev/include/linux/usbdevice_fs.h ---- linux/include/linux/usbdevice_fs.h Fri Apr 27 23:49:56 2001 -+++ linux-2.4.4-dev/include/linux/usbdevice_fs.h Tue May 22 23:57:35 2001 -@@ -157,6 +157,7 @@ - #define ISPECIAL (0<<28) - #define IBUS (1<<28) - #define IDEVICE (2<<28) -+#define IDEVICEMON (4<<28) /*USBMon Addition */ - #define IBUSNR(x) (((x)>>8)&0xff) - #define IDEVNR(x) ((x)&0xff) - -@@ -193,7 +194,8 @@ - extern struct usb_driver usbdevfs_driver; - extern struct file_operations usbdevfs_drivers_fops; - extern struct file_operations usbdevfs_devices_fops; --extern struct file_operations usbdevfs_device_file_operations; -+extern struct file_operations usbdevfs_devicemon_file_operations; -+extern struct file_operations usbdevfs_device_file_operations; /*USBMon*/ - extern struct inode_operations usbdevfs_device_inode_operations; - extern struct inode_operations usbdevfs_bus_inode_operations; - extern struct file_operations usbdevfs_bus_file_operations;