Commit graph

235 commits

Author SHA1 Message Date
Johannes Anderwald 8632f8d0f0 [USB-BRINGUP]
- add template for hidclass driver 
- fix hidusb build

svn path=/branches/usb-bringup/; revision=54759
2011-12-25 20:21:34 +00:00
Johannes Anderwald c9d5364c98 - rearrange hid stack
svn path=/branches/usb-bringup/; revision=54757
2011-12-25 18:25:18 +00:00
Johannes Anderwald d8200951b5 - rearrange hid stack
svn path=/branches/usb-bringup/; revision=54756
2011-12-25 18:23:22 +00:00
Johannes Anderwald 3c59337294 - rearrange hid stack
svn path=/branches/usb-bringup/; revision=54754
2011-12-25 18:17:07 +00:00
Johannes Anderwald b03bdfff2a - add directory for hid stack
svn path=/branches/usb-bringup/; revision=54753
2011-12-25 18:16:35 +00:00
Johannes Anderwald 1205becf05 [USB-BRINGUP]
- Implement HidP_UsageListDifference, HidP_GetUsagesEx, HidP_UsageAndPageListDifference
- Fix api prototypes
- Fix HidP_GetUsages linking

svn path=/branches/usb-bringup/; revision=54752
2011-12-25 17:09:09 +00:00
Johannes Anderwald 756f0b704b [USBEHCI]
- Implement URB_FUNCTION_ISOCH_TRANSFER, URB_FUNCTION_CLASS_ENDPOINT, URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE

svn path=/branches/usb-bringup/; revision=54736
2011-12-23 15:20:00 +00:00
Johannes Anderwald 6cd3e83d47 [HIDUSB]
- Add stub hidusb driver
- Hidusb driver is reponsible to connect with the hidclass driver (not yet present) and connect hid framework with usb hid devices

svn path=/branches/usb-bringup/; revision=53500
2011-08-30 16:01:00 +00:00
Cameron Gutman b8d27ea0ac [USBSTOR]
- Fix a typo so SRB_FUNCTION_RELEASE_DEVICE actually does what was intended

svn path=/branches/usb-bringup/; revision=52072
2011-06-03 05:43:41 +00:00
Cameron Gutman 392e4b95be [USBSTOR]
- Don't leave DISPATCH_LEVEL while holding a spin lock acquired at DISPATCH_LEVEL
- Synchronize cancellation checking by acquiring the cancel spin lock

svn path=/branches/usb-bringup/; revision=52071
2011-06-03 05:38:27 +00:00
Johannes Anderwald ab7ce0c45c [HIDPARSE]
- Start of HID parser driver
- Contains currently only stubs

svn path=/branches/usb-bringup/; revision=52067
2011-06-02 19:13:51 +00:00
Johannes Anderwald 0dede89665 [USBSTOR]
- Comment out getting usb device interface. It is currently unused and usbhub does not yet support it
- Forward pnp capabilities request to lower device object
- Fix compilation by Usurp

svn path=/branches/usb-bringup/; revision=52063
2011-06-02 15:35:04 +00:00
Johannes Anderwald da9d8082b0 [USBSTOR]
- Remove superflous declaration
- Fix bug when quering for compatible ids
- Remove unused local variable

svn path=/branches/usb-bringup/; revision=52038
2011-06-01 11:31:34 +00:00
Johannes Anderwald d7582766db [USBHUB_NEW]
- Check if the port is usb 2.0 controller. In that case call the Usb2.0 initialize function
- Prevents crash when used with usbohci

svn path=/branches/usb-bringup/; revision=52036
2011-06-01 08:31:33 +00:00
Johannes Anderwald 804a2dc28a [USBHUB_NEW]
- Fix compilation

svn path=/branches/usb-bringup/; revision=52035
2011-06-01 08:10:41 +00:00
Johannes Anderwald f73caa061d [USBOHCI]
- More traces to fix isochronous problem
- Fix broken assert found by mjmartin

svn path=/branches/usb-bringup/; revision=52004
2011-05-30 06:55:32 +00:00
Johannes Anderwald d2accc6c3e [USBOHCI]
- Fix OHCI_ISO_TD structure. Fixes host system crashes in Windows XP
- Fix multiple bugs in isochronous transfer implementation
- Still not yet working, as the interrupt completion is not fired yet

svn path=/branches/usb-bringup/; revision=51998
2011-05-29 19:54:55 +00:00
Johannes Anderwald 2231c8333a [USBOHCI]
- Implement function to retrieve isochronous head endpoint descriptor
- Implement function to retrieve current frame number
- Set isochronous descriptor flag for head endpoint
- Implement retrieve device status for devices
- Implement retrieve class status from device
- Partly implement isochronous descriptor handling in usb queue
- Start implementing isochronous transfers in ISUBRequest
- Code currently not tested as the Virtual Machine with XP + ReactOS usbohci driver brings down the host system when starting the iso transfers. Ironically it crashes in MS usbohci driver


svn path=/branches/usb-bringup/; revision=51957
2011-05-27 13:04:55 +00:00
Johannes Anderwald 9aff3e967c [USBOHCI]
- Set up periodic threshold (90 %)
- Add function to retrieve interrupt endpoints
- Add function to retrieve specific descriptors from interface. These are used by HID devices such as mice / keyboards
- Add function to retrieve interrupt interval
- Enqueue all endpoint descriptors at the end of the associated queue
- Only notify hardware of insertion when it is an bulk / control request
- Scan interrupt endpoint list to find the completed transfer descriptor
- Add debugging function to print out linked endpoint descriptors
- Interrupt transfers are now implemented. 
- Tested in Windows XP SP3 + Vbox 4.04 + Microsoft 5-Button Mouse. The HID mouse installs, initializes and starts up. Unfortunately the mouse does not work as expected yet

svn path=/branches/usb-bringup/; revision=51922
2011-05-26 12:37:18 +00:00
Johannes Anderwald 667b425b6c [USBOHCI]
- Remove dead code
- Silence traces
- Pass status & DoneHead as parameters to dpc routine
- Move IUSBRequest cleanup code into new function and use it for bulk / control transfer cleanup
- Fix bugs in AllocateEndpointDescriptor. It did not take the device address into account. It also did not respect the direction of the descriptor
- Implement support for bulk transfer requests
- Handle irp completion in CompletionCallback
- Tested in Windows XP SP3 + Vbox 4.04 + USB2.0 disabled + ReactOS usbstor + USB mass storage device
- OHCI Mass storage support is now also ready
- Next interrupt transfers

svn path=/branches/usb-bringup/; revision=51917
2011-05-26 02:15:11 +00:00
Johannes Anderwald 2c6077dc50 [USBOHCI]
- Add glue code for supporting iso transfers
- Remove dead from Handle
- Remove broken asserts
- Add support for string descriptors
- Add support for class specific endpoint requests (Needs be ported to usbehci)
- Link to usbd driver
- Add support for retrieving string descriptor
- Rewrite configuration descriptor handling in IUSBDevice. New code is smaller, smarter and handles a lot more cases. Needs to be ported to usbehci
- Wrap usbdlib.h include in extern c macro, it has c linkage
- Control transfers should now work 
- Need to implement support for isochronous / bulk / interrupt transfers until functional
- Tested with Bluetooth USB Stick (multi function, interrupt / bulk / control / isochronous) / USB Microphone (isochronous & control) in XP SP3

svn path=/branches/usb-bringup/; revision=51900
2011-05-25 02:11:06 +00:00
Johannes Anderwald beec9a7b25 [USBD]
- Add missing export

svn path=/branches/usb-bringup/; revision=51899
2011-05-24 23:03:35 +00:00
Johannes Anderwald ed6fad617e [USBOHCI]
- Don't allocate buffer twice
- Cleanup endpoint / general transfer descriptors

svn path=/branches/usb-bringup/; revision=51892
2011-05-24 18:29:57 +00:00
Johannes Anderwald e24bfbfa91 [USBOHCI]
- Add sanity checks
- Preserve  command status value when notifying the hc that a control / bulk endpoint was added
- Re-enable root hub notification interrupt when reset port has been completed
- Dispatch processing to USBQeueu when DoneHead event arrives
- Scan endpoints to find the logical endpoint which was completed by the hardware
- Signal completion to IUSBRequest by calling CompletionCallback
- Create a final transfer descriptor which is linked to the endpoint descriptor
- Control transfers now appear to be working (Device retrieves device descriptor / configuration descriptor and succeeds in setting device address)
- Configuration parsing code needs more work now (currently fails there due to invalid / unexpected configuration descriptor from device)

svn path=/branches/usb-bringup/; revision=51888
2011-05-24 17:57:00 +00:00
Johannes Anderwald b275073474 [USBOHCI]
- Enable global power mode
- Wait untill reset is complete
- Clear reset complete bit when reset is done
- Enable port
- Reset port now works
- USBOHCI still hangs after adding first control request, needs more investigation

svn path=/branches/usb-bringup/; revision=51883
2011-05-24 12:51:03 +00:00
Johannes Anderwald f75cb3d51d [USBOHCI]
- Start implementing control transfers
- Move initialization of usb queue after the bulk / control head endpoints have been created
- Add interface functions to retrieve bulk / control head endpoint descriptors
- Add macros for setting transfer descriptors field (taken from Haiku)
- Partly implement IUSBQueue::AddUSBRequest for control / bulk transfers
- Create endpoint descriptor for control request and link setup descriptor to it 
- Link setup descriptors to data descriptor / status descriptor
- WIP (needs fixes)

svn path=/branches/usb-bringup/; revision=51864
2011-05-23 17:42:52 +00:00
Johannes Anderwald c5acda628c [USBOHCI]
- Fix bug in calculating offset of status register
- Start implementing deferred processing routine
- Signal status change when new device is arrived
- Implement basic GetPortStatus
- Start implementing SetPortFeature, ClearPortStatus
- ResetPort not yet fully working, WIP

svn path=/branches/usb-bringup/; revision=51858
2011-05-23 11:29:55 +00:00
Johannes Anderwald 89d52d98bb [OHCI]
- Add check that controller is functional state
- enable interrupts after the controller has been started
- partly implement isr routine

svn path=/branches/usb-bringup/; revision=51852
2011-05-22 20:48:50 +00:00
Johannes Anderwald d4c4a2e080 [USBOHCI]
- Start of OHCI support
- Based on new usbehci driver and Haiku USB Stack
- Driver initializes the controller and retrieve number of ports

svn path=/branches/usb-bringup/; revision=51851
2011-05-22 19:36:13 +00:00
Johannes Anderwald 3dfadd12ae [USBEHCI]
- Enable sync frame list

svn path=/branches/usb-bringup/; revision=51827
2011-05-20 15:06:39 +00:00
Johannes Anderwald 9e2ca3d539 [USBEHCI]
- Pass memory manager to USBQueue object
- Fix bug in memory manager which did not check if an allocation equals page size
- Implement interrupt queue head array with frequencys of 1ms up to 32ms
- Store queue heads in the sync schedule array
- WIP

svn path=/branches/usb-bringup/; revision=51826
2011-05-20 14:47:15 +00:00
Michael Martin ff208f7adb [USBSTOR]
- Add error handling to USBSTOR_CSWCompletionRoutine for errors that can be recovered via reset of pipe/port/controller. Only pipe reset is attempted. WIP.

svn path=/branches/usb-bringup/; revision=51808
2011-05-17 11:26:25 +00:00
Johannes Anderwald a5d0b5fdef [USBSTOR]
- Implement retrieving serial number from device
- Use serial number to format instance id and retrieve in StorageDeviceProperty requests
- Silence traces


svn path=/branches/usb-bringup/; revision=51770
2011-05-15 17:57:02 +00:00
Johannes Anderwald e9a0c8ba68 [USBSTOR]
- Add asserts
- Rewrite queue methods to accept the FDO only 
- Fix multiple synchronization bugs
- Don't start next irp before current irp has completed
- Use contiouslogicalbytes blocks from srb
- Should fix race conditions

svn path=/branches/usb-bringup/; revision=51764
2011-05-15 14:59:16 +00:00
Johannes Anderwald 793e8870ca [USBSTOR]
- Fix one more warning

svn path=/branches/usb-bringup/; revision=51760
2011-05-15 12:49:17 +00:00
Johannes Anderwald 5c5f758afa [USBSTOR]
- Silence warnings
- Silence traces
- Add asserts
- Add code to detect usb reset in progress. In that case cancel the request
- Add more code to synchronize urb action
- WIP, still hangs are observed

svn path=/branches/usb-bringup/; revision=51759
2011-05-15 12:47:54 +00:00
Michael Martin e5f521c90a [USBSTOR]
- Start implementing error handling.
- On errors use a worker thread to attempt a recovery. If successful restart the operation that failed.
- If STALL_PID is received reset the pipe of the device.
- Not entered into code path yet. WIP.

svn path=/branches/usb-bringup/; revision=51754
2011-05-15 11:23:16 +00:00
Michael Martin f1ec4fbe16 [USBSTOR]
- USBSTOR_SendRequest: The buffer for read/write may not be NonPagedPool, which is documented as a requirement for using MmBuildMdlForNonPagedPool. Also locking the buffers pages is also not an option as the routine is called at DISPATCH_LEVEL.
It so happens that Irp->MdlAddress is valid for read/write operations. Use it instead of procedure above.
- Add a sanity check to make sure the Mdl does describe the transfer buffer.
Fixes IRQL_NOT_LESS_OR_EQUAL bugcheck in windows. These changes also may fixed writing to device.

svn path=/branches/usb-bringup/; revision=51752
2011-05-15 08:23:32 +00:00
Johannes Anderwald be12088a55 [USBSTOR]
- Start implementing queued srb handling
- Implement SRB_FUNCTION_RELEASE_QUEUE, SRB_FUNCTION_FLUSH, SRB_FUNCTION_FLUSH_QUEUE
- WIP, not yet working perfectly

svn path=/branches/usb-bringup/; revision=51739
2011-05-14 18:09:00 +00:00
Johannes Anderwald 3f8c058a07 [USBSTOR]
- Start implementing write command
- Disabled for now as it causes corruptions

svn path=/branches/usb-bringup/; revision=51695
2011-05-13 14:44:24 +00:00
Johannes Anderwald 89aa9d3264 [USBSTOR]
- Fix bug in read command, which uses wrong format. LBA address is stored in the CDB10 struct
- Don't build the mdl for nonpaged pool if the driver passes an mdl (i/o paging requests)
- Usbstor can now list disk contents and browse files when used in Windows XP
- Need to implement SCSIOP_WRITE to write files

svn path=/branches/usb-bringup/; revision=51694
2011-05-13 14:04:38 +00:00
Johannes Anderwald eb228159bc [USBSTOR]
- Handle SCSIOP_MEDIUM_REMOVAL
- Handle paging i/o requests. These request don't provide a data buffer in the srb, but the buffer is stored in the irp' mdl
- Fix the hack for unimplemented Mode Sense command
- Usbstor now completes initializes and receives read requests
- Still need to fix read request, as Windows XP fails to recognize the disk format, WIP

svn path=/branches/usb-bringup/; revision=51693
2011-05-13 13:37:50 +00:00
Michael Martin 98ed611448 [USBSTOR]
- Add a check at USBSTOR_FdoHandleStartDevice to make sure the device uses Bulk Transfers.
- Use macros for initializing the Urbs. The macros ensure that the proper fields of the URB are set correctly.
Fixes failing of getting device descriptor and getting devices BlockLength.


svn path=/branches/usb-bringup/; revision=51691
2011-05-13 09:14:28 +00:00
Michael Martin 9d7751a2f6 [USBHUB_NEW]
- Only get the string descriptors if they are available. Fixes crash when using usb mouse and keyboards in windows.

svn path=/branches/usb-bringup/; revision=51688
2011-05-12 23:31:32 +00:00
Michael Martin 76310d7679 [USBEHCI_NEW]
- Modify BuildBulkTransferQueueHead to support TransferBufferLengths larger than PAGE_SIZE * 5.
- Acquire a SpinLock before adding QueueHeads to AsyncList and PendingList.
- Dont request a new QueueHead for incomplete transfers in QueueHeadCompletion, as the memory for the just completed QueueHead has not been released yet. Doing so overwrites the m_TransferDescriptor[x] members with new address resulting in memory leaks. Instead request a new QueueHead after the QueueHead has been freed in QueueHeadCleanup.
- Fix a bug where a QueueHead was removed from the m_CompletedRequestAsyncList instead of the m_PendingRequestAsyncList.
- Temporary hackfix InternalCalculateTransferLength to return the TransferBufferLength. This hack will be removed as soon as possible.
- With these changes the hub and ehci driver allow viewing content of and transfers to/from usb disks.

svn path=/branches/usb-bringup/; revision=51684
2011-05-12 13:35:06 +00:00
Michael Martin 8d98341ac8 [USBHUB_NEW]
- Implement IOCTL_INTERNAL_USB_GET_PORT_STATUS.
- Fixes to comments




svn path=/branches/usb-bringup/; revision=51683
2011-05-12 12:58:07 +00:00
Johannes Anderwald b0b03bfdd1 [USBSTOR]
- Rewrite scsi method to act asynchronous

svn path=/branches/usb-bringup/; revision=51673
2011-05-11 03:49:15 +00:00
Michael Martin 4f76ebe078 [USBHUB_NEW]
- Save PortNumber in child device extensions as its needed when PNP request device capabilities.
- Handle IOCTL_INTERNAL_USB_SUBMIT_URB request by creating a new Irp and passing the Urb down to the miniport. 
- Now working with our ehci driver, we at least see a usb driver and can browse directory in Windows, though doing so results in assert as ehci doesnt support transfers over 5 Pages yet. Fix coming soon.



svn path=/branches/usb-bringup/; revision=51672
2011-05-11 02:25:11 +00:00
Johannes Anderwald fc298e51a5 [USBSTOR]
- Partly implement test unit command

svn path=/branches/usb-bringup/; revision=51671
2011-05-10 23:26:56 +00:00
Michael Martin db5142f32f [USBHUB_NEW]
- Forgotten change in 51641. Fixes build of usbhub.

svn path=/branches/usb-bringup/; revision=51657
2011-05-09 10:48:00 +00:00