aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/ABI/testing/sysfs-bus-usb33
-rw-r--r--Documentation/feature-removal-schedule.txt16
-rw-r--r--Documentation/filesystems/proc.txt7
-rw-r--r--Documentation/ide/ChangeLog.ide-cd.1994-2004268
-rw-r--r--Documentation/ide/ChangeLog.ide-floppy.1996-200263
-rw-r--r--Documentation/usb/gadget_printer.txt510
-rw-r--r--Documentation/usb/iuu_phoenix.txt84
7 files changed, 958 insertions, 23 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb
index 9734577d1711..11a3c1682cec 100644
--- a/Documentation/ABI/testing/sysfs-bus-usb
+++ b/Documentation/ABI/testing/sysfs-bus-usb
@@ -52,3 +52,36 @@ Description:
52 facility is inherently dangerous, it is disabled by default 52 facility is inherently dangerous, it is disabled by default
53 for all devices except hubs. For more information, see 53 for all devices except hubs. For more information, see
54 Documentation/usb/persist.txt. 54 Documentation/usb/persist.txt.
55
56What: /sys/bus/usb/device/.../power/connected_duration
57Date: January 2008
58KernelVersion: 2.6.25
59Contact: Sarah Sharp <sarah.a.sharp@intel.com>
60Description:
61 If CONFIG_PM and CONFIG_USB_SUSPEND are enabled, then this file
62 is present. When read, it returns the total time (in msec)
63 that the USB device has been connected to the machine. This
64 file is read-only.
65Users:
66 PowerTOP <power@bughost.org>
67 http://www.lesswatts.org/projects/powertop/
68
69What: /sys/bus/usb/device/.../power/active_duration
70Date: January 2008
71KernelVersion: 2.6.25
72Contact: Sarah Sharp <sarah.a.sharp@intel.com>
73Description:
74 If CONFIG_PM and CONFIG_USB_SUSPEND are enabled, then this file
75 is present. When read, it returns the total time (in msec)
76 that the USB device has been active, i.e. not in a suspended
77 state. This file is read-only.
78
79 Tools can use this file and the connected_duration file to
80 compute the percentage of time that a device has been active.
81 For example,
82 echo $((100 * `cat active_duration` / `cat connected_duration`))
83 will give an integer percentage. Note that this does not
84 account for counter wrap.
85Users:
86 PowerTOP <power@bughost.org>
87 http://www.lesswatts.org/projects/powertop/
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 181bff005167..a7d9d179131a 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -156,22 +156,6 @@ Who: Arjan van de Ven <arjan@linux.intel.com>
156 156
157--------------------------- 157---------------------------
158 158
159What: USB driver API moves to EXPORT_SYMBOL_GPL
160When: February 2008
161Files: include/linux/usb.h, drivers/usb/core/driver.c
162Why: The USB subsystem has changed a lot over time, and it has been
163 possible to create userspace USB drivers using usbfs/libusb/gadgetfs
164 that operate as fast as the USB bus allows. Because of this, the USB
165 subsystem will not be allowing closed source kernel drivers to
166 register with it, after this grace period is over. If anyone needs
167 any help in converting their closed source drivers over to use the
168 userspace filesystems, please contact the
169 linux-usb-devel@lists.sourceforge.net mailing list, and the developers
170 there will be glad to help you out.
171Who: Greg Kroah-Hartman <gregkh@suse.de>
172
173---------------------------
174
175What: vm_ops.nopage 159What: vm_ops.nopage
176When: Soon, provided in-kernel callers have been converted 160When: Soon, provided in-kernel callers have been converted
177Why: This interface is replaced by vm_ops.fault, but it has been around 161Why: This interface is replaced by vm_ops.fault, but it has been around
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index 11fe51c036bf..194c8f351320 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -1134,13 +1134,6 @@ check the amount of free space (value is in seconds). Default settings are: 4,
1134resume it if we have a value of 3 or more percent; consider information about 1134resume it if we have a value of 3 or more percent; consider information about
1135the amount of free space valid for 30 seconds 1135the amount of free space valid for 30 seconds
1136 1136
1137audit_argv_kb
1138-------------
1139
1140The file contains a single value denoting the limit on the argv array size
1141for execve (in KiB). This limit is only applied when system call auditing for
1142execve is enabled, otherwise the value is ignored.
1143
1144ctrl-alt-del 1137ctrl-alt-del
1145------------ 1138------------
1146 1139
diff --git a/Documentation/ide/ChangeLog.ide-cd.1994-2004 b/Documentation/ide/ChangeLog.ide-cd.1994-2004
new file mode 100644
index 000000000000..190d17bfff62
--- /dev/null
+++ b/Documentation/ide/ChangeLog.ide-cd.1994-2004
@@ -0,0 +1,268 @@
1/*
2 * 1.00 Oct 31, 1994 -- Initial version.
3 * 1.01 Nov 2, 1994 -- Fixed problem with starting request in
4 * cdrom_check_status.
5 * 1.03 Nov 25, 1994 -- leaving unmask_intr[] as a user-setting (as for disks)
6 * (from mlord) -- minor changes to cdrom_setup()
7 * -- renamed ide_dev_s to ide_drive_t, enable irq on command
8 * 2.00 Nov 27, 1994 -- Generalize packet command interface;
9 * add audio ioctls.
10 * 2.01 Dec 3, 1994 -- Rework packet command interface to handle devices
11 * which send an interrupt when ready for a command.
12 * 2.02 Dec 11, 1994 -- Cache the TOC in the driver.
13 * Don't use SCMD_PLAYAUDIO_TI; it's not included
14 * in the current version of ATAPI.
15 * Try to use LBA instead of track or MSF addressing
16 * when possible.
17 * Don't wait for READY_STAT.
18 * 2.03 Jan 10, 1995 -- Rewrite block read routines to handle block sizes
19 * other than 2k and to move multiple sectors in a
20 * single transaction.
21 * 2.04 Apr 21, 1995 -- Add work-around for Creative Labs CD220E drives.
22 * Thanks to Nick Saw <cwsaw@pts7.pts.mot.com> for
23 * help in figuring this out. Ditto for Acer and
24 * Aztech drives, which seem to have the same problem.
25 * 2.04b May 30, 1995 -- Fix to match changes in ide.c version 3.16 -ml
26 * 2.05 Jun 8, 1995 -- Don't attempt to retry after an illegal request
27 * or data protect error.
28 * Use HWIF and DEV_HWIF macros as in ide.c.
29 * Always try to do a request_sense after
30 * a failed command.
31 * Include an option to give textual descriptions
32 * of ATAPI errors.
33 * Fix a bug in handling the sector cache which
34 * showed up if the drive returned data in 512 byte
35 * blocks (like Pioneer drives). Thanks to
36 * Richard Hirst <srh@gpt.co.uk> for diagnosing this.
37 * Properly supply the page number field in the
38 * MODE_SELECT command.
39 * PLAYAUDIO12 is broken on the Aztech; work around it.
40 * 2.05x Aug 11, 1995 -- lots of data structure renaming/restructuring in ide.c
41 * (my apologies to Scott, but now ide-cd.c is independent)
42 * 3.00 Aug 22, 1995 -- Implement CDROMMULTISESSION ioctl.
43 * Implement CDROMREADAUDIO ioctl (UNTESTED).
44 * Use input_ide_data() and output_ide_data().
45 * Add door locking.
46 * Fix usage count leak in cdrom_open, which happened
47 * when a read-write mount was attempted.
48 * Try to load the disk on open.
49 * Implement CDROMEJECT_SW ioctl (off by default).
50 * Read total cdrom capacity during open.
51 * Rearrange logic in cdrom_decode_status. Issue
52 * request sense commands for failed packet commands
53 * from here instead of from cdrom_queue_packet_command.
54 * Fix a race condition in retrieving error information.
55 * Suppress printing normal unit attention errors and
56 * some drive not ready errors.
57 * Implement CDROMVOLREAD ioctl.
58 * Implement CDROMREADMODE1/2 ioctls.
59 * Fix race condition in setting up interrupt handlers
60 * when the `serialize' option is used.
61 * 3.01 Sep 2, 1995 -- Fix ordering of reenabling interrupts in
62 * cdrom_queue_request.
63 * Another try at using ide_[input,output]_data.
64 * 3.02 Sep 16, 1995 -- Stick total disk capacity in partition table as well.
65 * Make VERBOSE_IDE_CD_ERRORS dump failed command again.
66 * Dump out more information for ILLEGAL REQUEST errs.
67 * Fix handling of errors occurring before the
68 * packet command is transferred.
69 * Fix transfers with odd bytelengths.
70 * 3.03 Oct 27, 1995 -- Some Creative drives have an id of just `CD'.
71 * `DCI-2S10' drives are broken too.
72 * 3.04 Nov 20, 1995 -- So are Vertos drives.
73 * 3.05 Dec 1, 1995 -- Changes to go with overhaul of ide.c and ide-tape.c
74 * 3.06 Dec 16, 1995 -- Add support needed for partitions.
75 * More workarounds for Vertos bugs (based on patches
76 * from Holger Dietze <dietze@aix520.informatik.uni-leipzig.de>).
77 * Try to eliminate byteorder assumptions.
78 * Use atapi_cdrom_subchnl struct definition.
79 * Add STANDARD_ATAPI compilation option.
80 * 3.07 Jan 29, 1996 -- More twiddling for broken drives: Sony 55D,
81 * Vertos 300.
82 * Add NO_DOOR_LOCKING configuration option.
83 * Handle drive_cmd requests w/NULL args (for hdparm -t).
84 * Work around sporadic Sony55e audio play problem.
85 * 3.07a Feb 11, 1996 -- check drive->id for NULL before dereferencing, to fix
86 * problem with "hde=cdrom" with no drive present. -ml
87 * 3.08 Mar 6, 1996 -- More Vertos workarounds.
88 * 3.09 Apr 5, 1996 -- Add CDROMCLOSETRAY ioctl.
89 * Switch to using MSF addressing for audio commands.
90 * Reformat to match kernel tabbing style.
91 * Add CDROM_GET_UPC ioctl.
92 * 3.10 Apr 10, 1996 -- Fix compilation error with STANDARD_ATAPI.
93 * 3.11 Apr 29, 1996 -- Patch from Heiko Eißfeldt <heiko@colossus.escape.de>
94 * to remove redundant verify_area calls.
95 * 3.12 May 7, 1996 -- Rudimentary changer support. Based on patches
96 * from Gerhard Zuber <zuber@berlin.snafu.de>.
97 * Let open succeed even if there's no loaded disc.
98 * 3.13 May 19, 1996 -- Fixes for changer code.
99 * 3.14 May 29, 1996 -- Add work-around for Vertos 600.
100 * (From Hennus Bergman <hennus@sky.ow.nl>.)
101 * 3.15 July 2, 1996 -- Added support for Sanyo 3 CD changers
102 * from Ben Galliart <bgallia@luc.edu> with
103 * special help from Jeff Lightfoot
104 * <jeffml@pobox.com>
105 * 3.15a July 9, 1996 -- Improved Sanyo 3 CD changer identification
106 * 3.16 Jul 28, 1996 -- Fix from Gadi to reduce kernel stack usage for ioctl.
107 * 3.17 Sep 17, 1996 -- Tweak audio reads for some drives.
108 * Start changing CDROMLOADFROMSLOT to CDROM_SELECT_DISC.
109 * 3.18 Oct 31, 1996 -- Added module and DMA support.
110 *
111 * 4.00 Nov 5, 1996 -- New ide-cd maintainer,
112 * Erik B. Andersen <andersee@debian.org>
113 * -- Newer Creative drives don't always set the error
114 * register correctly. Make sure we see media changes
115 * regardless.
116 * -- Integrate with generic cdrom driver.
117 * -- CDROMGETSPINDOWN and CDROMSETSPINDOWN ioctls, based on
118 * a patch from Ciro Cattuto <>.
119 * -- Call set_device_ro.
120 * -- Implement CDROMMECHANISMSTATUS and CDROMSLOTTABLE
121 * ioctls, based on patch by Erik Andersen
122 * -- Add some probes of drive capability during setup.
123 *
124 * 4.01 Nov 11, 1996 -- Split into ide-cd.c and ide-cd.h
125 * -- Removed CDROMMECHANISMSTATUS and CDROMSLOTTABLE
126 * ioctls in favor of a generalized approach
127 * using the generic cdrom driver.
128 * -- Fully integrated with the 2.1.X kernel.
129 * -- Other stuff that I forgot (lots of changes)
130 *
131 * 4.02 Dec 01, 1996 -- Applied patch from Gadi Oxman <gadio@netvision.net.il>
132 * to fix the drive door locking problems.
133 *
134 * 4.03 Dec 04, 1996 -- Added DSC overlap support.
135 * 4.04 Dec 29, 1996 -- Added CDROMREADRAW ioclt based on patch
136 * by Ales Makarov (xmakarov@sun.felk.cvut.cz)
137 *
138 * 4.05 Nov 20, 1997 -- Modified to print more drive info on init
139 * Minor other changes
140 * Fix errors on CDROMSTOP (If you have a "Dolphin",
141 * you must define IHAVEADOLPHIN)
142 * Added identifier so new Sanyo CD-changer works
143 * Better detection if door locking isn't supported
144 *
145 * 4.06 Dec 17, 1997 -- fixed endless "tray open" messages -ml
146 * 4.07 Dec 17, 1997 -- fallback to set pc->stat on "tray open"
147 * 4.08 Dec 18, 1997 -- spew less noise when tray is empty
148 * -- fix speed display for ACER 24X, 18X
149 * 4.09 Jan 04, 1998 -- fix handling of the last block so we return
150 * an end of file instead of an I/O error (Gadi)
151 * 4.10 Jan 24, 1998 -- fixed a bug so now changers can change to a new
152 * slot when there is no disc in the current slot.
153 * -- Fixed a memory leak where info->changer_info was
154 * malloc'ed but never free'd when closing the device.
155 * -- Cleaned up the global namespace a bit by making more
156 * functions static that should already have been.
157 * 4.11 Mar 12, 1998 -- Added support for the CDROM_SELECT_SPEED ioctl
158 * based on a patch for 2.0.33 by Jelle Foks
159 * <jelle@scintilla.utwente.nl>, a patch for 2.0.33
160 * by Toni Giorgino <toni@pcape2.pi.infn.it>, the SCSI
161 * version, and my own efforts. -erik
162 * -- Fixed a stupid bug which egcs was kind enough to
163 * inform me of where "Illegal mode for this track"
164 * was never returned due to a comparison on data
165 * types of limited range.
166 * 4.12 Mar 29, 1998 -- Fixed bug in CDROM_SELECT_SPEED so write speed is
167 * now set ionly for CD-R and CD-RW drives. I had
168 * removed this support because it produced errors.
169 * It produced errors _only_ for non-writers. duh.
170 * 4.13 May 05, 1998 -- Suppress useless "in progress of becoming ready"
171 * messages, since this is not an error.
172 * -- Change error messages to be const
173 * -- Remove a "\t" which looks ugly in the syslogs
174 * 4.14 July 17, 1998 -- Change to pointing to .ps version of ATAPI spec
175 * since the .pdf version doesn't seem to work...
176 * -- Updated the TODO list to something more current.
177 *
178 * 4.15 Aug 25, 1998 -- Updated ide-cd.h to respect mechine endianess,
179 * patch thanks to "Eddie C. Dost" <ecd@skynet.be>
180 *
181 * 4.50 Oct 19, 1998 -- New maintainers!
182 * Jens Axboe <axboe@image.dk>
183 * Chris Zwilling <chris@cloudnet.com>
184 *
185 * 4.51 Dec 23, 1998 -- Jens Axboe <axboe@image.dk>
186 * - ide_cdrom_reset enabled since the ide subsystem
187 * handles resets fine now. <axboe@image.dk>
188 * - Transfer size fix for Samsung CD-ROMs, thanks to
189 * "Ville Hallik" <ville.hallik@mail.ee>.
190 * - other minor stuff.
191 *
192 * 4.52 Jan 19, 1999 -- Jens Axboe <axboe@image.dk>
193 * - Detect DVD-ROM/RAM drives
194 *
195 * 4.53 Feb 22, 1999 - Include other model Samsung and one Goldstar
196 * drive in transfer size limit.
197 * - Fix the I/O error when doing eject without a medium
198 * loaded on some drives.
199 * - CDROMREADMODE2 is now implemented through
200 * CDROMREADRAW, since many drives don't support
201 * MODE2 (even though ATAPI 2.6 says they must).
202 * - Added ignore parameter to ide-cd (as a module), eg
203 * insmod ide-cd ignore='hda hdb'
204 * Useful when using ide-cd in conjunction with
205 * ide-scsi. TODO: non-modular way of doing the
206 * same.
207 *
208 * 4.54 Aug 5, 1999 - Support for MMC2 class commands through the generic
209 * packet interface to cdrom.c.
210 * - Unified audio ioctl support, most of it.
211 * - cleaned up various deprecated verify_area().
212 * - Added ide_cdrom_packet() as the interface for
213 * the Uniform generic_packet().
214 * - bunch of other stuff, will fill in logs later.
215 * - report 1 slot for non-changers, like the other
216 * cd-rom drivers. don't report select disc for
217 * non-changers as well.
218 * - mask out audio playing, if the device can't do it.
219 *
220 * 4.55 Sep 1, 1999 - Eliminated the rest of the audio ioctls, except
221 * for CDROMREADTOC[ENTRY|HEADER]. Some of the drivers
222 * use this independently of the actual audio handling.
223 * They will disappear later when I get the time to
224 * do it cleanly.
225 * - Minimize the TOC reading - only do it when we
226 * know a media change has occurred.
227 * - Moved all the CDROMREADx ioctls to the Uniform layer.
228 * - Heiko Eißfeldt <heiko@colossus.escape.de> supplied
229 * some fixes for CDI.
230 * - CD-ROM leaving door locked fix from Andries
231 * Brouwer <Andries.Brouwer@cwi.nl>
232 * - Erik Andersen <andersen@xmission.com> unified
233 * commands across the various drivers and how
234 * sense errors are handled.
235 *
236 * 4.56 Sep 12, 1999 - Removed changer support - it is now in the
237 * Uniform layer.
238 * - Added partition based multisession handling.
239 * - Mode sense and mode select moved to the
240 * Uniform layer.
241 * - Fixed a problem with WPI CDS-32X drive - it
242 * failed the capabilities
243 *
244 * 4.57 Apr 7, 2000 - Fixed sense reporting.
245 * - Fixed possible oops in ide_cdrom_get_last_session()
246 * - Fix locking mania and make ide_cdrom_reset relock
247 * - Stop spewing errors to log when magicdev polls with
248 * TEST_UNIT_READY on some drives.
249 * - Various fixes from Tobias Ringstrom:
250 * tray if it was locked prior to the reset.
251 * - cdrom_read_capacity returns one frame too little.
252 * - Fix real capacity reporting.
253 *
254 * 4.58 May 1, 2000 - Clean up ACER50 stuff.
255 * - Fix small problem with ide_cdrom_capacity
256 *
257 * 4.59 Aug 11, 2000 - Fix changer problem in cdrom_read_toc, we weren't
258 * correctly sensing a disc change.
259 * - Rearranged some code
260 * - Use extended sense on drives that support it for
261 * correctly reporting tray status -- from
262 * Michael D Johnson <johnsom@orst.edu>
263 * 4.60 Dec 17, 2003 - Add mt rainier support
264 * - Bump timeout for packet commands, matches sr
265 * - Odd stuff
266 * 4.61 Jan 22, 2004 - support hardware sector sizes other than 2kB,
267 * Pascal Schmidt <der.eremit@email.de>
268 */
diff --git a/Documentation/ide/ChangeLog.ide-floppy.1996-2002 b/Documentation/ide/ChangeLog.ide-floppy.1996-2002
new file mode 100644
index 000000000000..46c19ef32a9e
--- /dev/null
+++ b/Documentation/ide/ChangeLog.ide-floppy.1996-2002
@@ -0,0 +1,63 @@
1/*
2 * Many thanks to Lode Leroy <Lode.Leroy@www.ibase.be>, who tested so many
3 * ALPHA patches to this driver on an EASYSTOR LS-120 ATAPI floppy drive.
4 *
5 * Ver 0.1 Oct 17 96 Initial test version, mostly based on ide-tape.c.
6 * Ver 0.2 Oct 31 96 Minor changes.
7 * Ver 0.3 Dec 2 96 Fixed error recovery bug.
8 * Ver 0.4 Jan 26 97 Add support for the HDIO_GETGEO ioctl.
9 * Ver 0.5 Feb 21 97 Add partitions support.
10 * Use the minimum of the LBA and CHS capacities.
11 * Avoid hwgroup->rq == NULL on the last irq.
12 * Fix potential null dereferencing with DEBUG_LOG.
13 * Ver 0.8 Dec 7 97 Increase irq timeout from 10 to 50 seconds.
14 * Add media write-protect detection.
15 * Issue START command only if TEST UNIT READY fails.
16 * Add work-around for IOMEGA ZIP revision 21.D.
17 * Remove idefloppy_get_capabilities().
18 * Ver 0.9 Jul 4 99 Fix a bug which might have caused the number of
19 * bytes requested on each interrupt to be zero.
20 * Thanks to <shanos@es.co.nz> for pointing this out.
21 * Ver 0.9.sv Jan 6 01 Sam Varshavchik <mrsam@courier-mta.com>
22 * Implement low level formatting. Reimplemented
23 * IDEFLOPPY_CAPABILITIES_PAGE, since we need the srfp
24 * bit. My LS-120 drive barfs on
25 * IDEFLOPPY_CAPABILITIES_PAGE, but maybe it's just me.
26 * Compromise by not reporting a failure to get this
27 * mode page. Implemented four IOCTLs in order to
28 * implement formatting. IOCTls begin with 0x4600,
29 * 0x46 is 'F' as in Format.
30 * Jan 9 01 Userland option to select format verify.
31 * Added PC_SUPPRESS_ERROR flag - some idefloppy drives
32 * do not implement IDEFLOPPY_CAPABILITIES_PAGE, and
33 * return a sense error. Suppress error reporting in
34 * this particular case in order to avoid spurious
35 * errors in syslog. The culprit is
36 * idefloppy_get_capability_page(), so move it to
37 * idefloppy_begin_format() so that it's not used
38 * unless absolutely necessary.
39 * If drive does not support format progress indication
40 * monitor the dsc bit in the status register.
41 * Also, O_NDELAY on open will allow the device to be
42 * opened without a disk available. This can be used to
43 * open an unformatted disk, or get the device capacity.
44 * Ver 0.91 Dec 11 99 Added IOMEGA Clik! drive support by
45 * <paul@paulbristow.net>
46 * Ver 0.92 Oct 22 00 Paul Bristow became official maintainer for this
47 * driver. Included Powerbook internal zip kludge.
48 * Ver 0.93 Oct 24 00 Fixed bugs for Clik! drive
49 * no disk on insert and disk change now works
50 * Ver 0.94 Oct 27 00 Tidied up to remove strstr(Clik) everywhere
51 * Ver 0.95 Nov 7 00 Brought across to kernel 2.4
52 * Ver 0.96 Jan 7 01 Actually in line with release version of 2.4.0
53 * including set_bit patch from Rusty Russell
54 * Ver 0.97 Jul 22 01 Merge 0.91-0.96 onto 0.9.sv for ac series
55 * Ver 0.97.sv Aug 3 01 Backported from 2.4.7-ac3
56 * Ver 0.98 Oct 26 01 Split idefloppy_transfer_pc into two pieces to
57 * fix a lost interrupt problem. It appears the busy
58 * bit was being deasserted by my IOMEGA ATAPI ZIP 100
59 * drive before the drive was actually ready.
60 * Ver 0.98a Oct 29 01 Expose delay value so we can play.
61 * Ver 0.99 Feb 24 02 Remove duplicate code, modify clik! detection code
62 * to support new PocketZip drives
63 */
diff --git a/Documentation/usb/gadget_printer.txt b/Documentation/usb/gadget_printer.txt
new file mode 100644
index 000000000000..ad995bf0db41
--- /dev/null
+++ b/Documentation/usb/gadget_printer.txt
@@ -0,0 +1,510 @@
1
2 Linux USB Printer Gadget Driver
3 06/04/2007
4
5 Copyright (C) 2007 Craig W. Nadler <craig@nadler.us>
6
7
8
9GENERAL
10=======
11
12This driver may be used if you are writing printer firmware using Linux as
13the embedded OS. This driver has nothing to do with using a printer with
14your Linux host system.
15
16You will need a USB device controller and a Linux driver for it that accepts
17a gadget / "device class" driver using the Linux USB Gadget API. After the
18USB device controller driver is loaded then load the printer gadget driver.
19This will present a printer interface to the USB Host that your USB Device
20port is connected to.
21
22This driver is structured for printer firmware that runs in user mode. The
23user mode printer firmware will read and write data from the kernel mode
24printer gadget driver using a device file. The printer returns a printer status
25byte when the USB HOST sends a device request to get the printer status. The
26user space firmware can read or write this status byte using a device file
27/dev/g_printer . Both blocking and non-blocking read/write calls are supported.
28
29
30
31
32HOWTO USE THIS DRIVER
33=====================
34
35To load the USB device controller driver and the printer gadget driver. The
36following example uses the Netchip 2280 USB device controller driver:
37
38modprobe net2280
39modprobe g_printer
40
41
42The follow command line parameter can be used when loading the printer gadget
43(ex: modprobe g_printer idVendor=0x0525 idProduct=0xa4a8 ):
44
45idVendor - This is the Vendor ID used in the device descriptor. The default is
46 the Netchip vendor id 0x0525. YOU MUST CHANGE TO YOUR OWN VENDOR ID
47 BEFORE RELEASING A PRODUCT. If you plan to release a product and don't
48 already have a Vendor ID please see www.usb.org for details on how to
49 get one.
50
51idProduct - This is the Product ID used in the device descriptor. The default
52 is 0xa4a8, you should change this to an ID that's not used by any of
53 your other USB products if you have any. It would be a good idea to
54 start numbering your products starting with say 0x0001.
55
56bcdDevice - This is the version number of your product. It would be a good idea
57 to put your firmware version here.
58
59iManufacturer - A string containing the name of the Vendor.
60
61iProduct - A string containing the Product Name.
62
63iSerialNum - A string containing the Serial Number. This should be changed for
64 each unit of your product.
65
66iPNPstring - The PNP ID string used for this printer. You will want to set
67 either on the command line or hard code the PNP ID string used for
68 your printer product.
69
70qlen - The number of 8k buffers to use per endpoint. The default is 10, you
71 should tune this for your product. You may also want to tune the
72 size of each buffer for your product.
73
74
75
76
77USING THE EXAMPLE CODE
78======================
79
80This example code talks to stdout, instead of a print engine.
81
82To compile the test code below:
83
841) save it to a file called prn_example.c
852) compile the code with the follow command:
86 gcc prn_example.c -o prn_example
87
88
89
90To read printer data from the host to stdout:
91
92 # prn_example -read_data
93
94
95To write printer data from a file (data_file) to the host:
96
97 # cat data_file | prn_example -write_data
98
99
100To get the current printer status for the gadget driver:
101
102 # prn_example -get_status
103
104 Printer status is:
105 Printer is NOT Selected
106 Paper is Out
107 Printer OK
108
109
110To set printer to Selected/On-line:
111
112 # prn_example -selected
113
114
115To set printer to Not Selected/Off-line:
116
117 # prn_example -not_selected
118
119
120To set paper status to paper out:
121
122 # prn_example -paper_out
123
124
125To set paper status to paper loaded:
126
127 # prn_example -paper_loaded
128
129
130To set error status to printer OK:
131
132 # prn_example -no_error
133
134
135To set error status to ERROR:
136
137 # prn_example -error
138
139
140
141
142EXAMPLE CODE
143============
144
145
146#include <stdio.h>
147#include <stdlib.h>
148#include <fcntl.h>
149#include <linux/poll.h>
150#include <sys/ioctl.h>
151#include <linux/usb/g_printer.h>
152
153#define PRINTER_FILE "/dev/g_printer"
154#define BUF_SIZE 512
155
156
157/*
158 * 'usage()' - Show program usage.
159 */
160
161static void
162usage(const char *option) /* I - Option string or NULL */
163{
164 if (option) {
165 fprintf(stderr,"prn_example: Unknown option \"%s\"!\n",
166 option);
167 }
168
169 fputs("\n", stderr);
170 fputs("Usage: prn_example -[options]\n", stderr);
171 fputs("Options:\n", stderr);
172 fputs("\n", stderr);
173 fputs("-get_status Get the current printer status.\n", stderr);
174 fputs("-selected Set the selected status to selected.\n", stderr);
175 fputs("-not_selected Set the selected status to NOT selected.\n",
176 stderr);
177 fputs("-error Set the error status to error.\n", stderr);
178 fputs("-no_error Set the error status to NO error.\n", stderr);
179 fputs("-paper_out Set the paper status to paper out.\n", stderr);
180 fputs("-paper_loaded Set the paper status to paper loaded.\n",
181 stderr);
182 fputs("-read_data Read printer data from driver.\n", stderr);
183 fputs("-write_data Write printer sata to driver.\n", stderr);
184 fputs("-NB_read_data (Non-Blocking) Read printer data from driver.\n",
185 stderr);
186 fputs("\n\n", stderr);
187
188 exit(1);
189}
190
191
192static int
193read_printer_data()
194{
195 struct pollfd fd[1];
196
197 /* Open device file for printer gadget. */
198 fd[0].fd = open(PRINTER_FILE, O_RDWR);
199 if (fd[0].fd < 0) {
200 printf("Error %d opening %s\n", fd[0].fd, PRINTER_FILE);
201 close(fd[0].fd);
202 return(-1);
203 }
204
205 fd[0].events = POLLIN | POLLRDNORM;
206
207 while (1) {
208 static char buf[BUF_SIZE];
209 int bytes_read;
210 int retval;
211
212 /* Wait for up to 1 second for data. */
213 retval = poll(fd, 1, 1000);
214
215 if (retval && (fd[0].revents & POLLRDNORM)) {
216
217 /* Read data from printer gadget driver. */
218 bytes_read = read(fd[0].fd, buf, BUF_SIZE);
219
220 if (bytes_read < 0) {
221 printf("Error %d reading from %s\n",
222 fd[0].fd, PRINTER_FILE);
223 close(fd[0].fd);
224 return(-1);
225 } else if (bytes_read > 0) {
226 /* Write data to standard OUTPUT (stdout). */
227 fwrite(buf, 1, bytes_read, stdout);
228 fflush(stdout);
229 }
230
231 }
232
233 }
234
235 /* Close the device file. */
236 close(fd[0].fd);
237
238 return 0;
239}
240
241
242static int
243write_printer_data()
244{
245 struct pollfd fd[1];
246
247 /* Open device file for printer gadget. */
248 fd[0].fd = open (PRINTER_FILE, O_RDWR);
249 if (fd[0].fd < 0) {
250 printf("Error %d opening %s\n", fd[0].fd, PRINTER_FILE);
251 close(fd[0].fd);
252 return(-1);
253 }
254
255 fd[0].events = POLLOUT | POLLWRNORM;
256
257 while (1) {
258 int retval;
259 static char buf[BUF_SIZE];
260 /* Read data from standard INPUT (stdin). */
261 int bytes_read = fread(buf, 1, BUF_SIZE, stdin);
262
263 if (!bytes_read) {
264 break;
265 }
266
267 while (bytes_read) {
268
269 /* Wait for up to 1 second to sent data. */
270 retval = poll(fd, 1, 1000);
271
272 /* Write data to printer gadget driver. */
273 if (retval && (fd[0].revents & POLLWRNORM)) {
274 retval = write(fd[0].fd, buf, bytes_read);
275 if (retval < 0) {
276 printf("Error %d writing to %s\n",
277 fd[0].fd,
278 PRINTER_FILE);
279 close(fd[0].fd);
280 return(-1);
281 } else {
282 bytes_read -= retval;
283 }
284
285 }
286
287 }
288
289 }
290
291 /* Wait until the data has been sent. */
292 fsync(fd[0].fd);
293
294 /* Close the device file. */
295 close(fd[0].fd);
296
297 return 0;
298}
299
300
301static int
302read_NB_printer_data()
303{
304 int fd;
305 static char buf[BUF_SIZE];
306 int bytes_read;
307
308 /* Open device file for printer gadget. */
309 fd = open(PRINTER_FILE, O_RDWR|O_NONBLOCK);
310 if (fd < 0) {
311 printf("Error %d opening %s\n", fd, PRINTER_FILE);
312 close(fd);
313 return(-1);
314 }
315
316 while (1) {
317 /* Read data from printer gadget driver. */
318 bytes_read = read(fd, buf, BUF_SIZE);
319 if (bytes_read <= 0) {
320 break;
321 }
322
323 /* Write data to standard OUTPUT (stdout). */
324 fwrite(buf, 1, bytes_read, stdout);
325 fflush(stdout);
326 }
327
328 /* Close the device file. */
329 close(fd);
330
331 return 0;
332}
333
334
335static int
336get_printer_status()
337{
338 int retval;
339 int fd;
340
341 /* Open device file for printer gadget. */
342 fd = open(PRINTER_FILE, O_RDWR);
343 if (fd < 0) {
344 printf("Error %d opening %s\n", fd, PRINTER_FILE);
345 close(fd);
346 return(-1);
347 }
348
349 /* Make the IOCTL call. */
350 retval = ioctl(fd, GADGET_GET_PRINTER_STATUS);
351 if (retval < 0) {
352 fprintf(stderr, "ERROR: Failed to set printer status\n");
353 return(-1);
354 }
355
356 /* Close the device file. */
357 close(fd);
358
359 return(retval);
360}
361
362
363static int
364set_printer_status(unsigned char buf, int clear_printer_status_bit)
365{
366 int retval;
367 int fd;
368
369 retval = get_printer_status();
370 if (retval < 0) {
371 fprintf(stderr, "ERROR: Failed to get printer status\n");
372 return(-1);
373 }
374
375 /* Open device file for printer gadget. */
376 fd = open(PRINTER_FILE, O_RDWR);
377
378 if (fd < 0) {
379 printf("Error %d opening %s\n", fd, PRINTER_FILE);
380 close(fd);
381 return(-1);
382 }
383
384 if (clear_printer_status_bit) {
385 retval &= ~buf;
386 } else {
387 retval |= buf;
388 }
389
390 /* Make the IOCTL call. */
391 if (ioctl(fd, GADGET_SET_PRINTER_STATUS, (unsigned char)retval)) {
392 fprintf(stderr, "ERROR: Failed to set printer status\n");
393 return(-1);
394 }
395
396 /* Close the device file. */
397 close(fd);
398
399 return 0;
400}
401
402
403static int
404display_printer_status()
405{
406 char printer_status;
407
408 printer_status = get_printer_status();
409 if (printer_status < 0) {
410 fprintf(stderr, "ERROR: Failed to get printer status\n");
411 return(-1);
412 }
413
414 printf("Printer status is:\n");
415 if (printer_status & PRINTER_SELECTED) {
416 printf(" Printer is Selected\n");
417 } else {
418 printf(" Printer is NOT Selected\n");
419 }
420 if (printer_status & PRINTER_PAPER_EMPTY) {
421 printf(" Paper is Out\n");
422 } else {
423 printf(" Paper is Loaded\n");
424 }
425 if (printer_status & PRINTER_NOT_ERROR) {
426 printf(" Printer OK\n");
427 } else {
428 printf(" Printer ERROR\n");
429 }
430
431 return(0);
432}
433
434
435int
436main(int argc, char *argv[])
437{
438 int i; /* Looping var */
439 int retval = 0;
440
441 /* No Args */
442 if (argc == 1) {
443 usage(0);
444 exit(0);
445 }
446
447 for (i = 1; i < argc && !retval; i ++) {
448
449 if (argv[i][0] != '-') {
450 continue;
451 }
452
453 if (!strcmp(argv[i], "-get_status")) {
454 if (display_printer_status()) {
455 retval = 1;
456 }
457
458 } else if (!strcmp(argv[i], "-paper_loaded")) {
459 if (set_printer_status(PRINTER_PAPER_EMPTY, 1)) {
460 retval = 1;
461 }
462
463 } else if (!strcmp(argv[i], "-paper_out")) {
464 if (set_printer_status(PRINTER_PAPER_EMPTY, 0)) {
465 retval = 1;
466 }
467
468 } else if (!strcmp(argv[i], "-selected")) {
469 if (set_printer_status(PRINTER_SELECTED, 0)) {
470 retval = 1;
471 }
472
473 } else if (!strcmp(argv[i], "-not_selected")) {
474 if (set_printer_status(PRINTER_SELECTED, 1)) {
475 retval = 1;
476 }
477
478 } else if (!strcmp(argv[i], "-error")) {
479 if (set_printer_status(PRINTER_NOT_ERROR, 1)) {
480 retval = 1;
481 }
482
483 } else if (!strcmp(argv[i], "-no_error")) {
484 if (set_printer_status(PRINTER_NOT_ERROR, 0)) {
485 retval = 1;
486 }
487
488 } else if (!strcmp(argv[i], "-read_data")) {
489 if (read_printer_data()) {
490 retval = 1;
491 }
492
493 } else if (!strcmp(argv[i], "-write_data")) {
494 if (write_printer_data()) {
495 retval = 1;
496 }
497
498 } else if (!strcmp(argv[i], "-NB_read_data")) {
499 if (read_NB_printer_data()) {
500 retval = 1;
501 }
502
503 } else {
504 usage(argv[i]);
505 retval = 1;
506 }
507 }
508
509 exit(retval);
510}
diff --git a/Documentation/usb/iuu_phoenix.txt b/Documentation/usb/iuu_phoenix.txt
new file mode 100644
index 000000000000..e5f048067da4
--- /dev/null
+++ b/Documentation/usb/iuu_phoenix.txt
@@ -0,0 +1,84 @@
1Infinity Usb Unlimited Readme
2-----------------------------
3
4Hi all,
5
6
7This module provide a serial interface to use your
8IUU unit in phoenix mode. Loading this module will
9bring a ttyUSB[0-x] interface. This driver must be
10used by your favorite application to pilot the IUU
11
12This driver is still in beta stage, so bugs can
13occur and your system may freeze. As far I now,
14I never had any problem with it, but I'm not a real
15guru, so don't blame me if your system is unstable
16
17You can plug more than one IUU. Every unit will
18have his own device file(/dev/ttyUSB0,/dev/ttyUSB1,...)
19
20
21
22How to tune the reader speed ?
23
24 A few parameters can be used at load time
25 To use parameters, just unload the module if it is
26 already loaded and use modprobe iuu_phoenix param=value.
27 In case of prebuilt module, use the command
28 insmod iuu_phoenix param=value.
29
30 Example:
31
32 modprobe iuu_phoenix clockmode=3
33
34 The parameters are:
35
36 parm: clockmode:1=3Mhz579,2=3Mhz680,3=6Mhz (int)
37 parm: boost:overclock boost percent 100 to 500 (int)
38 parm: cdmode:Card detect mode 0=none, 1=CD, 2=!CD, 3=DSR, 4=!DSR, 5=CTS, 6=!CTS, 7=RING, 8=!RING (int)
39 parm: xmas:xmas color enabled or not (bool)
40 parm: debug:Debug enabled or not (bool)
41
42- clockmode will provide 3 different base settings commonly adopted by
43 different software:
44 1. 3Mhz579
45 2. 3Mhz680
46 3. 6Mhz
47
48- boost provide a way to overclock the reader ( my favorite :-) )
49 For example to have best performance than a simple clockmode=3, try this:
50
51 modprobe boost=195
52
53 This will put the reader in a base of 3Mhz579 but boosted a 195 % !
54 the real clock will be now : 6979050 Hz ( 6Mhz979 ) and will increase
55 the speed to a score 10 to 20% better than the simple clockmode=3 !!!
56
57
58- cdmode permit to setup the signal used to inform the userland ( ioctl answer )
59 if the card is present or not. Eight signals are possible.
60
61- xmas is completely useless except for your eyes. This is one of my friend who was
62 so sad to have a nice device like the iuu without seeing all color range available.
63 So I have added this option to permit him to see a lot of color ( each activity change the color
64 and the frequency randomly )
65
66- debug will produce a lot of debugging messages...
67
68
69 Last notes:
70
71 Don't worry about the serial settings, the serial emulation
72 is an abstraction, so use any speed or parity setting will
73 work. ( This will not change anything ).Later I will perhaps
74 use this settings to deduce de boost but is that feature
75 really necessary ?
76 The autodetect feature used is the serial CD. If that doesn't
77 work for your software, disable detection mechanism in it.
78
79
80 Have fun !
81
82 Alain Degreffe
83
84 eczema(at)ecze.com