Commit graph

403 commits

Author SHA1 Message Date
Dmitry Fleytman
35cb09f07a UsbDk: BZ#1136908/BZ#1101593 Fix unsuccessfull driver installation pop-ups
This patch fixes 2 issues from Bugzilla:

1. BZ#1136908 - Windows XP launches "Found New Hardware" dialog
                when the device gets redirected after plugging
2. BZ#1101593 - Windows reports unsuccessful driver installation
                after USB redirection

Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-09-09 18:10:48 +03:00
Dmitry Fleytman
f31d25fde7 UsbDk: Cache configuration descriptors on QDR
It is basically forbidden to send arbitrary requests to device
directly via PDO while device driver is present in device stack.
This may lead to unexpected behaviour because device may be
in many different states e.g. low power, processing other
requests etc.

In order to avoid sending descriptor requests to devices with
active functional driver we're caching all descriptors we need
on QDR post-processing while we're on top of device stack for
sure.

Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-09-09 18:10:47 +03:00
Dmitry Fleytman
fede63de4f UsbDk: Introduce CBufferSet class
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-09-09 18:10:46 +03:00
Dmitry Fleytman
536e35fda8 UsbDk: Make CObjHolder deleter template parameter
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-09-09 18:10:46 +03:00
Dmitry Fleytman
9efa94607e UsbDk: Make CObjHolder::operator= follow best practices
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-09-09 18:10:45 +03:00
Dmitry Fleytman
e04099b3d6 UsbDk: Add more traces on new child registration
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-09-09 18:10:44 +03:00
Pavel Gurvich
e435c25be5 UsbDk: BZ#1139434 Windows XP crashes after some time of a realtime USB traffic (webcam)
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-09-09 17:54:26 +03:00
Pavel Gurvich
df4ccac547 UsbDk: Fix output data length for transfer requests
WDF request completion information must always be
sizeof(USBDK_TRANSFER_REQUEST) because this is what
user mode passes to Read/Write syscalls.

The length of transfered data must be always returned via
USB_DK_TRANSFER_RESULT structure.

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-20 17:28:54 +03:00
Pavel Gurvich
5db75d296e UsbDk: Fill DEVICE_CAPABILITIES as required for QueryCapabilities IRP
The problem revealed while testing with driver verifier.

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-20 17:28:53 +03:00
Pavel Gurvich
413c56304c UsbDk: Remove unused IOCTL RemoveRedirect
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-20 17:28:52 +03:00
Pavel Gurvich
2757bfc506 UsbDkHelper: Remove unused RemoveRedirect method
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-20 17:28:52 +03:00
Pavel Gurvich
f36902947a Revert "UsbDk: Fix never completed IOCTLs issue"
This reverts commit eb1e6fc61d.

The fix is not needed. The problem observed was related to HW.

Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-20 17:28:51 +03:00
Pavel Gurvich
eb1e6fc61d UsbDk: Fix never completed IOCTLs issue
In some cases driver sends IOCTLS to the underlying devices.
It uses IoBuildDeviceIoControlRequest() function to allocate
IOCTL IRP.

This function allocates threaded IRP which has a number of
limitations for contexts it may be sent from.
In particular it must be sent from PASSIVE_LEVEL
and non-arbitrary thread context to complete successfully.

Since this is not always true for contexts driver sends IRPs from,
never completed IOCTLs were observed on load tests.

This patch fixes the problem by using IoAllocateIrp()
function to allocate IOCTL IRPs.

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-17 09:30:53 +03:00
Pavel Gurvich
9c891832c2 UsbDk: Fix race conditions in device enumeration
During stop redirection process driver signals
redirection stopped event before adding corresponding
device back to childen list.

In case of unfortunate timing client code that
enumerates devices right after stoppng redirection
may not get device for which redirection was stopped
in devices list.

This patch fixes the issue by changing order of
corresponding operations.

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-17 09:29:56 +03:00
Pavel Gurvich
47e5e036a1 UsbDk: Fix stop redirection failures
Move redirection stopped event signalling from DeviceAdd
callback to QDR post-processing callback.

DeviceAdd callback is not (usually) called for non-redirected devices.

Without this patch stop redirection process fails to
complete because corresponing event never set.

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-17 09:01:52 +03:00
Dmitry Fleytman
d83afefae0 UsbDk: Add all build output to .gitignore
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-12 11:30:32 +03:00
Dmitry Fleytman
d9aa8f4621 Build: Add version information into binaries
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-12 11:29:47 +03:00
Pavel Gurvich
6956b7ba35 UsbDkController: Fix message text when reboot is required on install
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-11 13:25:36 +03:00
Pavel Gurvich
6c1f136844 UsbDkHelper: Fix processing of reboot needed case on install
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-11 13:23:51 +03:00
Dmitry Fleytman
a679fb0386 Build: Rename package project to avoid spaces in file names
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-05 17:55:44 +03:00
Dmitry Fleytman
d4e1080d4c UsbDk: Process isochronous transfers requests
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-04 18:31:55 +03:00
Dmitry Fleytman
3a9f570d2e UsbDk: Introduce infrastructure for isochronous transfers
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-04 17:53:52 +03:00
Dmitry Fleytman
ce6f4b645b UsbDk: Introduce class for isochronous URB
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-04 17:45:34 +03:00
Dmitry Fleytman
cda83bc49e UsbDk: Implement isochronous URB allocation for Widnows XP
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-04 16:10:51 +03:00
Dmitry Fleytman
f57d561fd3 UsbDk: Introduce USHORT_MAX definition
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-04 13:07:19 +03:00
Dmitry Fleytman
0ed3967d14 UsbDk: Make WDFMEMORY accessor class type-aware
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-03 15:23:52 +03:00
Pavel Gurvich
b42b6b2092 UsbDk: Add completion context parameter for CWdfRequest
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-03 15:22:36 +03:00
Dmitry Fleytman
816de3e6a2 Build: Make build tree structure more formalized
1. Put all build output under Install/Install_Debug folders
2. Make x86/x64 paths symmetrical

Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-07-31 15:53:18 +03:00
Dmitry Fleytman
ed08ca71a2 Build: Introduce script for batch builds
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-07-31 15:53:17 +03:00
Pavel Gurvich
d0da1a29c8 UsbDk: Use Transfer type instead of Endpoint address.
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-07-30 15:10:00 +03:00
Pavel Gurvich
3952264ae6 UsbDk: add TransferType enum to UsbDkData.h
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-07-30 15:09:51 +03:00
Dmitry Fleytman
ded5ad4245 UsbDk: Add README.md file with basic information
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-07-03 13:40:22 +03:00
Pavel Gurvich
1e4a50708d UsbDk: Split IoInCallerContextRW() function
This is a refactoring commit to make code more simple.

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-07-03 13:04:32 +03:00
Pavel Gurvich
4f4a211556 UsbDk: Avoid deadlocks on device reconfiguration
Some transfers may be pended for a long time, especially
on input pipes. In order to avoid deadlocks cancel pending
transfers instead of waiting for completion.

Replace WdfIoQueueStopSynchronously() by WdfIoQueueDrain()

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-07-03 13:00:35 +03:00
Pavel Gurvich
f6b5cb2056 UsbDk: Allow control transfers without data buffer
According to spec control transfer may have no data buffer.
Make driver process cases like this properly.

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-07-03 08:54:37 +03:00
Pavel Gurvich
4a677d08fc UsbDk: Return proper status on CUsbDkRedirectorStrategy::IoInCallerContext failure
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-07-02 18:14:58 +03:00
Pavel Gurvich
bb1e76a829 UsbDk: Remove junk trace on SetAltSettings
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-07-02 18:11:04 +03:00
Pavel Gurvich
77131d9ff5 UsbDk: fix traces on user mode handle creation
During user mode redirector handle creation we wait for
device to appear. During this process we may take a few
unsuccessfull attempts to open device handle.

Do not print error messages for this attempts.

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-07-02 18:10:29 +03:00
Pavel A
2985741dd6 UsbDk: Introduce .editorconfig file
Editorconfig is a nice tool that simplifies
maintenance of consistent coding style.

See http://editorconfig.org for details.

Signed-off-by: Pavel Aronsky <pavel.aronsky@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-06-22 09:31:22 +03:00
Pavel Aronsky
746614d717 UsbDk: added support for WinXP; get device speed
Signed-off-by: Pavel Aronsky <pavel.aronsky@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-06-16 15:05:47 +03:00
Pavel Aronsky
913582965c UsbDk: added check for IRQL in CIrp::ForwardAndWait
Signed-off-by: Pavel Aronsky <pavel.aronsky@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-06-16 15:05:46 +03:00
Pavel Aronsky
701988dd69 UsbDk: Drop dead code
CWdfUrb class and CWdfUsbTarget::ConfigurationDescriptor()
are not used anymore.

Signed-off-by: Pavel Aronsky <pavel.aronsky@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-06-16 15:05:45 +03:00
Pavel Gurvich
72cf6b764d UsbDk: Do not create symlinks for redirector devices
Symlinks not needed anymore since we create redirector handles
in kernel.

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-06-12 01:02:49 +03:00
Pavel Gurvich
99f3c0dbef UsbDkHelper: Open redirector handle in driver
This commit contains user mode adaptations for
driver interface changes introduced by previous commit.

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-06-12 01:00:08 +03:00
Dmitry Fleytman
5c4d0af852 UsbDk: Open redirector handle in driver
This commit makes redirection creation atomic operation
from user mode client point of view.

This ensures redirection will be stopped automatically
in case of unexpected user mode client termination.

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-06-12 00:57:33 +03:00
Dmitry Fleytman
c95fb22cdb UsbDk: Introduce more CWdfDevice methods
Newly introduced:
    CreateUserModeHandle()
    Reference()
    Dereference()

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-06-12 00:54:35 +03:00
Pavel Gurvich
3abe48f93b UsbDk: Drop ReadTransferRequestSafe()
Use newly introduced generic utility
UsdDkReadUserBufferSafe() instead.

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-06-12 00:22:54 +03:00
Pavel Gurvich
4a5b116872 UsbDk: Introduce UsdDkReadUserBufferSafe utility
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-06-12 00:21:34 +03:00
Pavel Gurvich
2b01cd5faf UsbDk: Add MillisecondsTo100Nanoseconds utility
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-06-12 00:16:37 +03:00
Pavel Gurvich
f67846ab44 UsbDk: Adjust acess mode of driver's IOCTLs
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-06-12 00:15:34 +03:00