| Author | 
                
Topic | 
                  | 
               
              
                | 
                 3963 
                 
                
                85 Posts  | 
                
                  
                    
                      
                       Posted - 25 Jul 2006 :  18:03:48
                        
                        
                      
  | 
                     
                    
                       So, I have an USB HID driver I came up with for CE 4.20, largely based on the sample HID driver.  We're in the  position of needing to get it working with CE 5.0.  I have two issues:
  1) Using the generic HID driver.  CE 5.0 now has enough generic HID support that it registers our device as HID1:.  This is fine with me, as then I don't need to support my own custom driver.  I can't however talk to our board via it.  The stream interface (read/write) isn't supported as it is on XP; neither is the other API I rely on in XP "HidD_SetFeature()" calls.  The other HID APIs exposed for dealing with reports in CE look like driver / kernel calls, not application level calls.  Not sure how I'd use them to talk to our device in any case...
  2) Using our driver.  I can juggle the registry keys a bit and get our driver to answer the DeviceAttach notification.  All seems to work except the call to ActivateDevice which returns Error code #1 ("Incorrect Function").  I'm thinking this error code is misleading, as if I pass the function bogus registry key, I get error code #1610 (“The configuration data for this product is corrupt.  Contact your support personnel.”).  I haven't spent too much time on this, but I'm running out of ideas.
  Any ideas? | 
                     
                   
                 | 
               
              
                | 
                 3963 
                 
                
                85 Posts  | 
                
                  
                    
                      
                       Posted - 31 Jul 2006 :  14:09:29
                        
                        
                      
  | 
                     
                    
                       So, we still need help here.  I've determined that what's going on is that DeviceManager wants to call the "Init" and "Deinit" functions, not the XXX_Init and XXX_Deinit functions as one would expect when specifying the "Prefix" and "Index" registry values.  Looking at the new DeviceManger code in CE 5.0 (which, BTW, looks like a fairly major rewrite compared to 4.20), it looks like the only causes for this would be the 'Flags' value of DEVFLAGS_NAKEDENTRIES or a missing 'Prefix' value.  My 'Flags' are set to 0, and there is indeed a 'Prefix' key, so I can't figure out why it's doing this.
  By defining the "Init" and "Deinit" functions, I can get my driver loaded and initialized; it even enumerates my USB device on the bus.  Unfortunately, if a 'Name' isn't registered under the 'Active' key (via the prefix/index combo (eg. "COM1:")), there's no way to access the stream driver via CreateFile, so I'm still hosed... | 
                     
                    
                        | 
                     
                   
                 | 
               
              
                | 
                 3963 
                 
                
                85 Posts  | 
                
                  
                    
                      
                       Posted - 31 Jul 2006 :  17:31:11
                        
                        
                      
  | 
                     
                    
                       OK, I'm guessing the problem is in the ADS registry driver.  When I read the 'Prefix' key, it has the correct contents, but the wrong length (12 bytes, not 8).   The DeviceManager code only reads 8 bytes, so the RegQueryKey call fails and the prefix is zeroed out.  
  The 8 bytes are for four wide chars: 3 for the prefix, on for a null term.  For example, the registry setting in ADSLOAD.reg
  "Prefix"="ABC" 
  yeilds a string value of length 12, not 8.
  I can work around it for now by writing the 'Prefix' value programmatically in my driver. | 
                     
                    
                       Edited by - 3963 on 31 Jul 2006  17:39:47 | 
                     
                    
                        | 
                     
                   
                 | 
               
              
                | 
                 bsamuels 
                 
                
                53 Posts  | 
                
                  
                    
                      
                       Posted - 01 Aug 2006 :  16:19:05
                        
                        
                      
  | 
                     
                    
                      |  Thanks for the details. Our software group is currently looking at this and we will update this topic when it is resolved. | 
                     
                    
                        | 
                     
                   
                 | 
               
              
                |   | 
                
Topic | 
                  | 
               
             
           | 
         
       
     |