Commit Graph

86 Commits

Author SHA1 Message Date
Brian Feldman
320f640b93 It's not very useful to set a softc refcount around blocking read/write
operations when the refcount doesn't protect the opens and closes.  Fix
this, and don't actually let a time out happen: now ugen(4) devices do
not get freed out from under the programs with them open.
2004-07-01 02:07:01 +00:00
Warner Losh
d1458cfdf4 MFp4: First batch of dev/usb/usbdevs.h -> usbdevs.h changes. 2004-06-27 12:41:44 +00:00
Lukas Ertl
5bebcf6d1c MFNetBSD.
uhid.c (1.61), author: jdolecek
   add support for USB_GET_DEVICEINFO and USB_GET_STRING_DESC ioctls,
   with same meaning as for ugen(4)

usbdi_util.h (1.29), usb_quirks.c (1.50), uhid.c (1.62),
ugen.c (1.68), usb_subr.c (1.114) author: mycroft
   Yes, some devices return incorrect lengths in their string
   descriptors.  Rather than losing, do what Windows does: just
   request the maximum size, and allow a shorter response.  Obsoletes
   the need for UQ_NO_STRINGS, and therefore these "quirks" are removed.

usb_subr.c (1.116), author: mycroft
    In the "seemed like a good idea until I found the fatal flaw"
    department...  Attempting to read a maximum-size string descriptor
    causes my kue device to go completely apeshit.  So, go back to the
    original method, but allow the device to return a shorter string than
    it claimed.

Obtained from:   NetBSD
2004-06-26 10:35:10 +00:00
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
Poul-Henning Kamp
dc08ffec87 Device megapatch 4/6:
Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
2004-02-21 21:10:55 +00:00
Poul-Henning Kamp
c9c7976f7f Device megapatch 1/6:
Free approx 86 major numbers with a mostly automatically generated patch.

A number of strategic drivers have been left behind by caution, and a few
because they still (ab)use their major number.
2004-02-21 19:42:58 +00:00
Seigo Tanimura
512824f8f7 - Implement selwakeuppri() which allows raising the priority of a
thread being waken up.  The thread waken up can run at a priority as
  high as after tsleep().

- Replace selwakeup()s with selwakeuppri()s and pass appropriate
  priorities.

- Add cv_broadcastpri() which raises the priority of the broadcast
  threads.  Used by selwakeuppri() if collision occurs.

Not objected in:	-arch, -current
2003-11-09 09:17:26 +00:00
Bernd Walter
8b43efbd44 Cache dev_t values in the right structure.
Tested by:	Jay Cornwall <jay@evilrealms.net>
2003-10-12 15:51:40 +00:00
Bernd Walter
1313b38492 Fix indention
Noticed by:	johan
2003-10-01 14:49:53 +00:00
Bernd Walter
a244477908 Don't call makedev().
Cache result of make_dev() and use it when calling destroy_dev().
2003-10-01 13:53:51 +00:00
Poul-Henning Kamp
ed692400eb I don't know from where the notion that device driver should or
even could call VOP_REVOKE() on vnodes associated with its dev_t's
has originated, but it stops right here.

If there are things people belive destroy_dev() needs to learn how to
do, please tell me about it, preferably with a reproducible test case.

Include <sys/uio.h> in bluetooth code rather than rely on <sys/vnode.h>
to do so.

The fact that some of the USB code needs to include <sys/vnode.h>
still disturbs me greatly, but I do not have time to chase that.
2003-09-28 20:48:13 +00:00
Josef Karthauser
219b479f9f Fix the cdevsw compatibility for -stable. 2003-08-25 22:01:06 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Josef Karthauser
5c8ea6280c Make note of some NetBSD patches that we already have. 2003-07-14 20:11:52 +00:00
Josef Karthauser
d4322278fa MFNetBSD:
date: 2002/09/23 05:51:20;  author: simonb;
    Remove breaks after returns, unreachable returns and returns after
    returns(!).
2003-07-14 18:25:47 +00:00
John-Mark Gurney
c97325b0c8 WARNING: white space diff
This code reduces the number of trailing white space to be more in line
w/ NetBSD.  I don't regenerate usbdevs, saving that for when it really
changes.
2003-07-04 01:50:39 +00:00
Bernd Walter
6445c6bdf1 Correct the fix in rev 1.70
Some lines were misslocated

Submitted by:	Jay Cornwall <jay@evilrealms.net>
Approved by:	re (rwatson)
2003-05-29 23:47:12 +00:00
Bernd Walter
d7a1c636e1 Recreate devnodes on USB_SET_ALTINTERFACE ioctl.
This fixes net/pppoa port for Alcatel Speedtouch devices.

Submitted by: Jay Cornwall <jay@evilrealms.net>
Tested by: Francois Rogler <francois@rogler.org>
Approved by: re (scottl)
2003-05-18 21:22:00 +00:00
Poul-Henning Kamp
7ac40f5f59 Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by:    re(scottl)
2003-03-03 12:15:54 +00:00
John Hay
11229bf39e Implement outgoing interrupt pipes. It is part of the USB 1.1 spec.
The Lego Infrared Tower use it.
2003-02-28 19:28:29 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
John Baldwin
9cbe11ea18 Cast a ptrdiff_t value to an int to quiet a warning since we don't support
%t in the kernel printf yet.
2002-11-07 21:34:21 +00:00
Josef Karthauser
3b7efc56d0 Use the hw.usb sysctl tree instead of debug.usb.
Requested by:	imp
2002-08-08 12:05:51 +00:00
Josef Karthauser
528d1a7fbc Replace the FOO_DEBUG definitions with USB_DEBUG, and switch the
debugging levels to off by default.  Now that debug levels can be
tweaked by sysctl we don't need to go through hoops to get the
different usb parts to produce debug data.
2002-07-31 14:34:36 +00:00
Josef Karthauser
0e6b196686 Get bored with hard coded debug level variables and introduce a debug.usb
sysctl tree for tweaking them real-time.

Reviewed by:	iedowse
2002-07-31 13:33:55 +00:00
Josef Karthauser
7db8d4d987 Delay the creation of the ugenX device node until we're certain
that the attach succeeded.  (Fixes a potential panic for devices
that fail to attach properly and are subsquently unplugged and then
plugged back in again.)
2002-07-09 01:01:25 +00:00
Josef Karthauser
567f4af63d MFNetBSD: ugen.c (1.57), ulpt.c (1.48), usb.c (1.67), usbdi.c (1.96),
usbdi.h (1.60)
	  (and local changes compatibility changes to ufm.c and urio.c)

    date: 2002/02/11 15:11:49;  author: augustss;
    Give usbd_do_request_flags() an extra argument for the timeout.
2002-05-06 18:23:36 +00:00
Josef Karthauser
be036866cf Be more specific about when block major numbers disappeared from
the cdev switch.
2002-03-11 16:22:15 +00:00
Alfred Perlstein
5bcd0580d7 Prefix structure members to protect them against clashes with eg.
c++ keywords.

This keeps us in sync with NetBSD because they actually committed
my delta first.

Ok'd by: lennard
2002-02-20 20:47:21 +00:00
Josef Karthauser
c67fd26e98 Re-add bmaj to the cdevsw's, but don't compile it in on -current.
This makes the code more portable between -current, -stable and the
other BSDs.
2002-02-15 22:54:10 +00:00
Josef Karthauser
0f24ab6fa0 Revert uio.uio_td back to uio.uio_procp, using a #define in usb_port to
do the right thing on -current.
2002-01-02 23:31:08 +00:00
Josef Karthauser
cbeffd9e61 Remove the special casing for NetBSD and OpenBSD now that they
appear to do what we do.
2002-01-02 16:45:15 +00:00
Josef Karthauser
44ae5917e2 NetBSD have introduced usb_proc_ptr for us (they'll be needing it soon too)
to hide the distinction between struct proc and struct thread.
2002-01-02 16:33:53 +00:00
Josef Karthauser
6035292097 Synchronise with NetBSD.
In order of importance:
* Make ugen use updated frlengths.
* More tests for NULL pipes.
* Generate better error codes on bulk write.
* Error messages in general.
2001-12-31 00:52:17 +00:00
Julian Elischer
b40ce4165d KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha
2001-09-12 08:38:13 +00:00
Nick Hibma
aa75eeda2f Only clear endpoint stall if status was USBD_STALLED.
This avoids panicing the system by unplugging a hub. The interrupt transfer
would sometimes arrive after the driver had been removed.
2001-09-02 09:26:14 +00:00
Nick Hibma
f3dfa83f4f Add safety belts. A control endpoint doesn't have an endpoint descriptor. 2001-08-30 21:45:28 +00:00
Nick Hibma
e1f5734cbe Pull in the most recent version of usb_quirks.h and propagate the necessary
changes to the various files.

Also, pull in most of the current usb_subr.c file.
2001-07-05 10:12:59 +00:00
Poul-Henning Kamp
f83880518b Send the remains (such as I have located) of "block major numbers" to
the bit-bucket.
2001-03-26 12:41:29 +00:00
Garrett Wollman
0a2c3d48c6 select() DKI is now in <sys/selinfo.h>. 2001-01-09 04:33:49 +00:00
Nick Hibma
040639a0aa make sure we tear down the devnodes for the endpoints 1 and above
when switching configuration.
2000-12-12 10:19:19 +00:00
Roger Hardiman
2c097d3332 Add Isochronus transfer mode support required by
USB WebCams, using a patch from Peter Housel.

With this change ugen, and with Peter's 'vid' program
in ports/graphics/vid, we can capture single images from USB Cameras
using the OmniVision OV511 chipset (including some models of the
Creative WebCam 3)

NetBSD merged in Peter's patch to their ugen.c file
several months ago, so this brings us back in line.

Submitted by:	Peter Housel <housel@acm.org>
		http://members.home.com/housel/
Approved by:	Nick Hibma
2000-12-07 10:28:25 +00:00
Roger Hardiman
5f41c13187 Non functional change.
Change a few indentations to tabs.
Change the functions to use ANSI sytle parameters.

This lowers the diffs between our copy of ugen.c and NetBSD's copy

Approved by:	Nick Hibma
2000-12-07 10:13:18 +00:00
Poul-Henning Kamp
53ce36d17a Remove unneeded #include <sys/proc.h> lines. 2000-10-29 13:57:19 +00:00
Nick Hibma
4f04f78215 Remove __P prototypes to reduce diffs between the NetBSD and FreeBSD
versions.
2000-07-17 18:41:20 +00:00
Nick Hibma
bb05811e6a Sync with NetBSD:
Mostly textual changes.
Set configuration to 0 (reset all endpoints) on open.
2000-05-14 17:33:26 +00:00
Nick Hibma
128aa3af3c Change Lennart's e-mail address. 2000-05-14 16:43:10 +00:00
Nick Hibma
cdb51d12a6 OpenBSD has a broken debugger that does not grok static. Use a
#define Static  static

that the OpenBSD folks can define it to be empty if they like.
2000-04-03 20:58:30 +00:00
Nick Hibma
290c9a02c3 Fix flushing of the clists before deleting them. Stops the machine
from panicing when disconnecting a USB Wacom Graphire tablet.

jhk approved the fix some time ago, but I forgot to actually commit the
thing.

Reported by:	Dirk van Gulik <dirkx@webweaving.org>
Approved by:	jhk
2000-03-02 16:01:53 +00:00