Re: USB keyboard HID problem

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Steve Schrock [MS] (sschrock_at_online.microsoft.com)
Date: 06/22/04


Date: Tue, 22 Jun 2004 11:34:30 -0700

Thank you for that information. That is a good change for the common case
where there is only one HID input report or where the first input report is
the largest. If this is not the case, then there is probably not much that
software can do to get the HID device to work on SH7727.

In the upcoming release of CE, we do something like the following to get the
count of bytes used for transfers.

    for (DWORD dwReport = 0; dwReport < phidpDeviceDesc->ReportIDsLength;
++dwReport) {
        PHIDP_REPORT_IDS phidpReportIds =
&phidpDeviceDesc->ReportIDs[dwReport];
        *pcbMaxReport = max(*pcbMaxReport, phidpReportIds->InputLength);
    }

-- 
Steve Schrock
Windows CE Device Drivers
This posting is provided "AS IS" with no warranties, and confers no rights.
"R.Fichter" <Ft.nospam@emtrion.de> wrote in message 
news:eOHxhLTSEHA.3932@TK2MSFTNGP10.phx.gbl...
> Hello Steve,
>
> you have to modify the function InterruptThreadProc in the file
> %_WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\USB\CLASS\HIDCLASS\HID.CPP.
> In this function you have to add a line so that the code look like
>
>    pbDataBuffer = pbToTransfer = (BYTE*) HidAlloc(cbBuffer);
>    if (pbDataBuffer == NULL) {
>        DEBUGMSG(ZONE_ERROR, (TEXT("%s: LocalAlloc error:%d\r\n"), 
> pszFname,
> GetLastError()));
>        goto EXIT;
>    }
>
> //+ added by emtrion (www.emtrion.com)
> cbToTransfer = pUsbHid->phidpDeviceDesc->ReportIDs[0].InputLength;
> //- added by emtrion  (www.emtrion.com)
>
>    if (fNoReportID == TRUE) {
>        // Leave the starting byte empty for the ID of 0
>        pbDataBuffer[0] = 0;
>        ++pbToTransfer;
>    }
>
> This modification solve the problem, that sometimes the USB Host 
> controller
> in the SH7727 adds an additional byte when more bytes are requested than
> delivered by the external device (short packets). This problem is 
> described
> as a hardware restriction in the USB Host chapter of the SH7727 hardware
> manual. With the modification shown above, the HID driver always requests
> exactly the number of bytes which are send by the HID device (e.g. mouse 
> or
> keyboard).
>
> Ruediger
>
> "Steve Schrock [MS]" <sschrock@online.microsoft.com> schrieb im 
> Newsbeitrag
> news:eo3Fd4MSEHA.1764@TK2MSFTNGP10.phx.gbl...
>> The USB HID driver stack was completely re-written for CE 4.2 so that it
>> would work with devices that deviate from the samples given in the USB 
>> HID
>> specifications.
>>
>> Ruediger, could you explain the changes you were required to make to get
>> KBDHID to work with the SH7727? I am not familiar with its USB host
>> controller. Thank you.
>>
>> -- 
>> Steve Schrock
>> Windows CE Device Drivers
>>
>> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>>
>> "R.Fichter" <Ft.nospam@emtrion.de> wrote in message
>> news:eZ7V%23O6REHA.3016@tk2msftngp13.phx.gbl...
>> > I've never used the SH7727 with CE 4.0. But I think the problem occurs
>> > also
>> > in Ce 4.0 because it is caused by the hardware restriction. May be that
>> > the
>> > frequency of the occurrence is not so often in CE 4.0 than in CE 4.2.
> But
>> > why ? I don't know.
>> >
>> > Ruediger
>> >
>> > "Rajesh" <rajeshvinchhi@hotmail.com> schrieb im Newsbeitrag
>> > news:d318ab39.0405302306.707e8441@posting.google.com...
>> >> That may be correct that there may be hardware problem in SH7727 OHCI
>> >> but still I have one question, why it is working with Windows CE 4.0
>> >> ?( there is no separate HID driver for sh7727 in Windows CE 4.0). I am
>> >> using the common USBHID driver in Windows CE 4.0 and it is working
>> >> fine.
>> >>
>> >> Why the USBHID/KBDHID driver given in Windows CE 4.2 requires specific
>> >> modifications for SH7727 ?
>> >>
>> >> Rajesh
>> >
>> >
>>
>>
>
> 


Relevant Pages

  • Re: How to use 2 USB mice independently and simultaneously?
    ... you can distinguish between independent input streams using ... windows open the mouse for exclusive access immediately when it ... I have to go below OS mouse events (below mouse driver) as ... > the HID input reports. ...
    (microsoft.public.development.device.drivers)
  • Re: Sample HID Client App for WinCE 4.2
    ... I am using a PocketPC model that has USB ... I have emailed the author of the HID mouse driver you refered ... >> I am trying to write a very simple windows CE application that will open ...
    (microsoft.public.pocketpc)
  • How to use 2 USB mice independently and simultaneously?
    ... INDEPENDENT USB mice SIMULTANEOUSLY as input devices. ... the HID input reports. ... I see some solutions if I cannot access HID mouse from HID driver ... At Windows level if there is some differentiation possible to see ...
    (microsoft.public.development.device.drivers)
  • Re: ADM851X USB-LAN-Adapter driver
    ... If it's not the adapter, it's the USB host hardware. ... timing differences in when power is applied, etc. on Windows CE vs. desktop ... source (and ask for a CE5-compatible driver, for goodness sake!), turn on ...
    (microsoft.public.windowsce.platbuilder)
  • USB Host Driver
    ... We are currently developing a specialized USB host controller mini-port ... driver that is not UHCI, OHCI, or EHCI compliant for Windows 2K, 2003 server, ...
    (microsoft.public.development.device.drivers)