Commit graph

183 commits

Author SHA1 Message Date
ftrvxmtrx 2ef8c9ed41 nusb: workaround for endpoints with same index but different types
nusb code assumes endpoint numbers are unique.  It's true in general
case, but it becomes false once the direction bit is ignored.  The
commit adds a check so that two endpoints of different types are not
merged into one with Eboth direction.  It does overwrite endpoint
though, so it shouldn't be considered as a full fix.
2014-04-23 23:45:00 +02:00
ftrvxmtrx 99c0abc76d nusb/ether: add RNDIS support (tested on Nexus 5) 2014-04-22 23:34:52 +02:00
cinap_lenrek b94c766fef nusb: dont include <bio.h>, we'r not using it (thanks erik) 2014-04-19 16:18:39 +02:00
ftrvxmtrx 9204ed8910 nusb/kb: fix trackpoint on thinkpad usb keyboard
The trackpoint has no subclass, but it's still a pointer device.
Also close the device while we are here.
2014-04-18 16:43:43 +02:00
aiju 26a8accad2 nusb: added joy 2014-03-09 18:03:07 +01:00
cinap_lenrek f88d0c372d nusb: fix loaddevstr() (thanks erik quanstro and richard miller)
loaddevstr() should request 256 bytes, as per standard and
respect the length embedded in the string.
2014-03-06 22:53:20 +01:00
cinap_lenrek fc78640118 nusb/ether: fix pointer truncation 2014-02-14 14:18:09 +01:00
cinap_lenrek 4a9f900726 mkfiles: do not rely on path containing the . element
when executing generated binaries and helper scripts,
always execute them as ./name instead of relying that
path contsins the dot.
2013-10-26 20:22:01 +02:00
cinap_lenrek 8ceb100fa4 nusb/ether: new driver interface with kernel inspired Block buffers
introduce kernel inspured Block structure with
read/write pointers to pass packets arround.

the intend is to avoid copying when adding/removing
frame headers and simplifying the drivers.

the driver now calls etheriq() directly allowing it to
queue multiple packets in one pass without having
to keep state.

transmit gets a buffer passed that has room for
frame headers and trailers so no copying is needed.

blocks are refcounted avoiding another copy when
passed to only one receive queue (common case).

receive queues are now limited to 100KB avoiding
buffer bloat.

Dq* a memory leak in destroyfid has been fixed.

lots of minor cleanups.
2013-10-18 18:41:27 +02:00
cinap_lenrek 52fc6d50d4 nusb/ether: fix wrong size check causing odd sized packets to be discarded (thanks mischief!)
ethernet packets with sizes that where not multiples of 4 where
discarded because the check uses the smsc frame size instead of
the payload size. when a usb read returns just one packet, theres
no next frame header and the calculated frame size is bigger than
the usb read which caused the whole packet to be discarded as invalid.

thanks to mischief for testing and debugging!
2013-10-16 16:42:40 +02:00
cinap_lenrek 965bb2d248 nusb/disk: handle blocking usb access with srv released
usb is bound after /dev, so a hanging usb device will hang
access to /dev. we avoid this by releasing the srv, which
allows the fs to still handle reads and walks of the
directories.

ios are serialized by a qlock in the Umsc structure.
2013-10-16 12:26:56 +02:00
ppatience0 225cc4af5c nusb/ether: add rtl8150 driver, remove unused includes 2013-10-02 02:25:43 -04:00
cinap_lenrek f8cbd5d12f nusb/serial: set exit status 2013-09-15 16:21:43 +02:00
ppatience0 334054e0e7 nusb/ether: add aue driver for admtek pegasus usb ethernet adapter 2013-08-24 19:18:15 -04:00
cinap_lenrek bfe852b3a2 nusb/kb: *really* only send to mousein when mouse state actually changes (zero detlas, same buttons) 2013-08-10 08:47:43 +02:00
cinap_lenrek 2012ba4d03 revert previous commit... stupid idea 2013-08-10 08:37:13 +02:00
cinap_lenrek f887f71320 nusb/kb: only send to mousein when mouse state actually changes 2013-08-10 07:59:54 +02:00
ppatience0 473d12c94f nusb: only read 18 bytes for device descriptor 2013-07-05 18:42:15 -04:00
ppatience0 d1b6c02ac9 nusb/ether: fix asixread() invert/shift in wrong order 2013-06-19 21:25:08 -04:00
cinap_lenrek 1a6d523d26 nusb/ether: fix asixwrite()
invert/shift in wrong order causing low 16 bits to be all ffff...
2013-06-18 02:00:05 +02:00
ppatience0 89ed97aaa2 nusb/ether: call sysfatal if dev is nil 2013-06-16 20:37:51 -04:00
cinap_lenrek 97c4381dc4 nusb/kb: map button 4 to middle button 2 (for logitech 5 button mouse) 2013-06-02 23:45:38 +02:00
cinap_lenrek 4c6c7be688 nusb/kb: simplify repeat logic as scancode now contains the info about esc1 extension 2013-05-18 01:46:25 +02:00
ftrvxmtrx 506cae05df nusb/kb: oops, fixup 2013-05-18 01:03:13 +02:00
ftrvxmtrx 811c3e8d78 nusb/kb: use a flag to indicate extended code; fix the most unix-friendly key on se/fi kbd layout 2013-05-18 01:01:34 +02:00
cinap_lenrek e83d5a84f2 nusb/serial: Add support for Amontec JTAGkey devices (from sources) 2013-04-26 15:25:25 +02:00
cinap_lenrek 9f25f9504a nusb/disk: add small delay after unit start command (for thinkpad sdcard reader)
diskparts fails on thinkpad x200 sdcard reader if we dont
give the unit some time to startup. the device took about
100ms to become ready so status poll loop with a long
timeout would be overkill.
2013-03-10 04:06:42 +01:00
cinap_lenrek 6bd2c26a85 nusb/kb: fix "Home" key producing "7" with some usb keyboards (import from sources patch/usb-khome)
Fixes the problem with certain keyboards generating "7" on "Home" key press.

http://9fans.net/archive/2013/03/8
http://9fans.net/archive/2013/03/10
2013-03-01 19:53:11 +01:00
cinap_lenrek af3dad5490 nusb/disk: allow 12 and 16 byte raw scsi commands (from erik quanstro) 2013-02-13 10:03:53 +01:00
cinap_lenrek d41f67c2b9 audio: fix delay control, increase default buffer delay to 40ms
just doing a single sleep isnt enougth, as we get woken
up for every block!
2013-02-01 15:23:38 +01:00
cinap_lenrek a2b83a5aea nusb/kb: increase maximum report descriptor size, non-continuous endpoints (from richard millars usbmouse-endpoint patch)
Another band-aid fix to the usb mouse driver, to cope with a mouse which has
an interrupt endpoint number 3 but no number 1 or 2, and a report descriptor
more than 128 bytes long.
2013-01-30 20:33:28 +01:00
cinap_lenrek 68c5dc8014 nusb/serial: add silabs driver (from sources) 2013-01-25 17:12:15 +01:00
cinap_lenrek 8c81499659 scsi: do only 36 byte inquiry
some devices freeze up with inqiry allocation length
other than 36 bytes. as we do not really care about
the vendor specific part of the inquiry, lets only do
36 byte inquiry for now.
2013-01-03 20:46:25 +01:00
cinap_lenrek 8f3595e058 nusb/kb: remove mouse acceleration -a flag
mouse acceleration can be done by software in the kernels
devmouse device like:

echo hwaccel off >/dev/mousectl
echo accelerated 5 >/dev/mousectl

it is hard to pass nusb/kb parameters anyway as it is started
from nusbrc in bootfs.paq, so i remove the option.
2012-12-26 22:48:12 +01:00
cinap_lenrek 7b34e8e759 nusb/kb: use report protocol for mouse
instead of forcing mouse to boot protocol, which often
doesnt work, we set it to report protocol and parse
the hid report descriptor. if thers no such descriptor
we revert to boot protocol.

all mouse packet parsing is done by report parser,
even for boot protocol. also all the work arrounds
for the leadbyte hack (report id?) are removed.

keyboards should not be affected by this change.
2012-12-19 12:09:35 +01:00
cinap_lenrek 3971337d13 nusb: provide language id when reading string descriptors (thanks ftrvxmtrx)
there are devices which do not return a string if used
with invalid language id, so at least try to use the first
one and choose english if failed.

this fixes CDC ethernet for N900
2012-12-10 10:36:53 +01:00
cinap_lenrek 6e630a2d1f nusb/ether: remove debug prints, cleanup 2012-12-06 00:31:25 +01:00
cinap_lenrek 29ca49ca38 nusb/ether: remove vid check in smsc driver, cleanup cdc driver 2012-12-06 23:24:42 +01:00
cinap_lenrek 23239adf54 nusb/ether: port drivers for asix and smsc ethernet 2012-12-06 23:05:24 +01:00
cinap_lenrek 86eaffdcaa nusb/kb: fix 5ms sleep polling in repeatproc, notegroup, cleanup
fix repeatproc timeout handling, add constants for Kbdelay
and Kbrepeat.

set procname so one knows which is keyboard and which is mouse
and on what endpoints they work.

9front's /dev/mousein and /dev/kbdin allow multiple opens,
so theres no need for the refcounted Kin structures.

spawn the worker procs in ther own note group, so they wont
get killed on interrupt in the original notegroup.
2012-11-30 19:01:59 +01:00
cinap_lenrek 3f25f69718 nusb/kb: add support for evoluent vertical mouse 2012-11-30 04:02:03 +01:00
cinap_lenrek 4260392749 nusb/kb: skip 0x01 lead byte hack, you dont wanna know
apparently, some mouse send constant 0x01 byte
before normal 4 byte mouse packet. this is known in
openbsd/freebsd as UQ_MS_LEADING_BYTE quirk.
2012-11-25 22:37:53 +01:00
cinap_lenrek aadc581040 nusb/kb: zero reads, error handling, priority, cleanup
handle short reads as errors and retry. this can happen
on ohci and some ps2 to usb converter. it might'v deen caused
by a recent change on sources handling td overrun differently.

fix error handling. have to check f->ep == nil after recovery
and check packet size. also, use f->ep->dfd instead of ptrfd
and kbdfd as it might be different after recovery. make a
setleds() error non fatal.

boost process priority for keyboard and mouse worker processes.

cleanup: use single write() in putmod(), improve error reporting.
2012-11-24 16:37:39 +01:00
cinap_lenrek a064a48e6d nusb: handle 0 csp value on iface, remove unneeded configdev() calls after getdev() 2012-09-06 05:25:23 +02:00
cinap_lenrek 3cdaf6ea5f usbd: add missing quotefmtinstall 2012-09-06 04:07:51 +02:00
cinap_lenrek 93063b3db0 nusbd: properly handle port detach on hub disconnect 2012-09-05 00:06:20 +02:00
cinap_lenrek 142a77c9dc nusb/kb: increase mouse packet buffer from 32 to 64 bytes for Microsoft Sidewinder X5 Mouse (thanks Rexford Gibbs for reporting and testing) 2012-08-13 10:41:02 +02:00
cinap_lenrek 5377a19447 nusb/audio: setup audioin 2012-05-03 22:30:32 +02:00
cinap_lenrek 9b0fc40aee nusbd: properly terminate worker proc if no hubs can be found 2012-03-09 07:55:01 +01:00
cinap_lenrek 424f8a9520 nusb: debug flags 2012-03-01 18:56:54 +01:00
cinap_lenrek f2b6ec3140 correcting unicode superscripts for 1 2 and 3 2012-02-23 16:58:53 +01:00
stanley lieber b8136286b6 kb.c: add curly braces to enable usb mouse nub scrolling 2011-11-30 22:12:04 -06:00
cinap_lenrek b298429804 ptp: fix fallback case 2011-09-03 03:26:44 +02:00
glenda e2f0077935 ptp: screw interrupts, use GetPartialObject to make rpcs shorter so it doesnt matter when we flush 2011-09-02 19:25:17 -04:00
cinap_lenrek aff787ea2a nusb/ether: fix exit status 2011-08-27 07:43:20 +02:00
cinap_lenrek 6074cf1319 nusb: add ethernet 2011-08-26 15:37:47 +02:00
cinap_lenrek 1404cc5077 nusb: fix documentation, cleanup, remove /sys/src/cmd/usb 2011-08-26 05:24:55 +02:00
cinap_lenrek 68576f5119 nusb/ptp: fix memory leaks, use libthread/ioprocs, cleanup 2011-08-22 03:05:01 +02:00
cinap_lenrek a4d2297e96 nusb/disk: small clenups 2011-08-19 05:20:42 +02:00
cinap_lenrek d25b95f4f2 nusb/ptp: implement flushing 2011-08-19 05:19:57 +02:00
cinap_lenrek 9f65da6d70 usb/ptp: ignore zero reads 2011-08-17 00:46:33 +02:00
cinap_lenrek b0f1c5ed6c usb ptp camera driver 2011-08-16 01:47:59 +02:00
cinap_lenrek 676a876df6 usb: added buffer delay control 2011-08-01 19:02:50 +02:00
cinap_lenrek 3a076c7a95 nusb: export a volume file and allow setting speed 2011-08-01 05:34:04 +02:00
cinap_lenrek b43de8eb1f nusb: fix usage inconsitency, shr names 2011-08-01 02:36:02 +02:00
cinap_lenrek e5bab1dd9f nusb: put setleds in kbwork 2011-08-01 02:01:04 +02:00
aiju 5bf221bab7 kb: don't do setleds on mice 2011-07-31 15:02:01 +02:00
cinap_lenrek d1b98305de nusb: fix enumarate bug, rename startdev/rmdev 2011-07-31 10:46:03 +02:00
aiju 9f4184892c added nusb/serial 2011-07-30 19:14:18 +02:00
aiju 2ba1b4c476 changed dev/rmdev to attach/detach, fixed nusbrc 2011-07-30 16:28:45 +02:00
aiju 54ed5417a9 merge 2011-07-30 14:32:33 +02:00
aiju 6aed9711b4 devshr: changed #σc to contain directories
nusb: detaching
2011-07-30 14:30:27 +02:00
cinap_lenrek 3f08f1d849 nusb: make private namespace for usb drivers, add nusb/audio to mkfile 2011-07-30 14:15:55 +02:00
cinap_lenrek 488add7e5e nusb: simple playback only audio driver 2011-07-30 13:57:21 +02:00
cinap_lenrek f9846213d1 nusb: change usbevent format, put nusbrc in bootfs 2011-07-30 07:23:26 +02:00
cinap_lenrek 9d49fcdb37 nusb: handle sub hubs 1970-01-01 01:34:55 +01:00
aiju 7f27b397ca nusb: more locking, also close dfd 2011-07-29 16:24:52 +02:00
aiju 61d322679b minor polishing of usbd 2011-07-29 10:24:18 +02:00
aiju 6f824732a6 usbd: improved event file 2011-07-28 21:26:42 +02:00
aiju 4792c6bef9 usbd: added event file, removed usbdb 2011-07-28 17:31:45 +02:00
aiju e3cc408215 nusb/disk: adaption to lib9p 2011-07-28 14:20:00 +02:00
aiju 05d09f086f nusb: improved 2011-07-27 20:07:30 +02:00
aiju 1a2afe988b started work on new usbd 2011-07-27 14:27:22 +02:00