HidD_SetFeature Failure #2

Hi All,

   I'm new to HID class devices. I'm working on printers. I need to
set the features on the printer. In HID class, i'm using
HidD_SetFeature command for this. This is failing and when given
GetLastError(), i get "The Semaphore Timeout period has expired". The
part of code is

#define PRINTER_SET_CONFIGURATION	{0x1F...0x00,0x00}

main()
{
	BYTE bBuff[64] ;
	WORD wRead ;
	HANDLE h = openHid() ;

	if (h != INVALID_HANDLE_VALUE)
	{
		CheckDevice(h) ;

		BYTE bBuff[] = PRINTER_SET_CONFIGURATION;
		SetData_FeatureIn(h,4,bBuff) ;

		RecvData_FeatureIn(h,sizeof(bBuff),bBuff,&wRead) ;
		CloseHandle(h) ;

	}
	if (pPrepData)
	{
		HidD_FreePreparsedData((PHIDP_PREPARSED_DATA) pPrepData);
	}
	return 0 ;
}
HANDLE openHid()
{
          .
          .
          .
	return m_handle ;
}


BOOL CheckDevice(HANDLE h)
{
	NTSTATUS              ntResult;
	PHIDP_VALUE_CAPS      pTheseCaps;
  WORD                  wCapsCount;
	int                   nVix ;


  if(HidD_GetPreparsedData(h, &pPrepData) == FALSE)
	{
    return FALSE ;
	}

	ntResult = HidP_GetCaps ((PHIDP_PREPARSED_DATA) pPrepData,
&stCapabilities);
	  wCapsCount = stCapabilities.NumberOutputValueCaps;

  pTheseCaps = (PHIDP_VALUE_CAPS)
malloc(wCapsCount*sizeof(HIDP_VALUE_CAPS));

  if(pTheseCaps == NULL)
  {
    return FALSE;
  }

  ntResult = HidP_GetValueCaps(   HidP_Output,
                                  pTheseCaps,
                                  &wCapsCount,
                                  (PHIDP_PREPARSED_DATA) pPrepData);

  if(ntResult != HIDP_STATUS_SUCCESS)
  {
    free(pTheseCaps);
    return FALSE;
  }

  for(nVix = 0; nVix < wCapsCount; nVix++)
  {
    ...
      continue;
     }
  free(pTheseCaps);

	// Feature
	wCapsCount = stCapabilities.NumberFeatureValueCaps;

  pTheseCaps = (PHIDP_VALUE_CAPS)malloc(wCapsCount *
sizeof(HIDP_VALUE_CAPS));

  if(pTheseCaps == NULL)
  {
    return FALSE;
  }

  ntResult = HidP_GetValueCaps(   HidP_Feature,
                                  pTheseCaps,
                                  &wCapsCount,
                                  (PHIDP_PREPARSED_DATA) pPrepData);

  if(ntResult != HIDP_STATUS_SUCCESS)
  {
    free(pTheseCaps);

    return FALSE;
  }

  for(nVix = 0; nVix < wCapsCount; nVix++)
  {
       ...
  }


  free(pTheseCaps);

	return TRUE ;
}


BOOL SetData_FeatureIn(HANDLE h,WORD wLen,BYTE *bBuff)
{
   .
   .
   .
  bOK =
HidD_SetFeature(h,bptr,stCapabilities.FeatureReportByteLength);
 int x = GetLastError();
  if(bOK == FALSE)
  {
		free(bptr) ;
    return FALSE;
  }
	free(bptr) ;
	return bOK ;
}


BOOL RecvData_FeatureIn(HANDLE h,WORD wLen,BYTE *bBuff,WORD *wRead)
{
    ...
}

Please help on the same.


Thanks in advance

Sathya

0
6/20/2007 3:23:59 PM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies
614 Views

Similar Articles

[PageSpeed] 36

Reply:

Similar Artilces:

Ink #2
Man I have found this site that has the cheapest ink for any printer. You can compare prices and then review the companies on service and quality. <http://www.imagraphix.com> Let me know what you think ...

Groups #2
I have an Exchange 2000 server that I inherited that has all the email groups setup as Global Security Groups. I need to be able to add one group to another group and it will not let me. Is there any way to do this without recreating the groups as distribution groups?? Is your AD native mode? Global Groups can be part of other Global Groups in same domain. -- Bharat Suneja MCSE, MCT -------------------------------- "Patricia" <me@hotmail.com> wrote in message news:u$u18zHuFHA.1132@TK2MSFTNGP10.phx.gbl... >I have an Exchange 2000 server that I inherited that has ...

Re-Naming a Project in Visual Studio 6.0 #2
I am trying to include multiple projects into a workspace that have the same Project name but have different underlying code. I would like to be able to alter the project name without having to re-create a new project. I have done this in the past using no more than the 'Find in Files' toolbar function in the whole project directory, and replacing all occurances of one project name with another. This is essentially a manual operation but can be done in say a quarter of an hour. Waiting now to hear of the easy way! "Ldraw" <Ldraw@discussions.microsoft.com> wrote in m...

Marking Clock #2
It is possible to synchronize the marking clock of schedule for the employee with the modulate of payroll and therefore obtain the pay for overtime? -- Jorge R. ...

Version incompatability #2
I have just bought a new computer & when I went to install MS publisher (2003 version) I found the disc is corrupted. I had a 1995 version on disc which I install but now none of my saved publisher files will open. Is there any way around this without having to buy a new copy of MS Publisher? Barbara155 wrote: > I have just bought a new computer & when I went to > install MS publisher (2003 version) I found the disc is > corrupted. I had a 1995 version on disc which I install > but now none of my saved publisher files will open. Is > there any way around this without...

Relay issue #2
Hi, I get thousands of messages like these a day: "Your message did not reach some or all of the intended recipients. Subject: THOUGHT Y0U M|GHT BE INTERESTED... Sent: 2/2/2005 12:43 PM The following recipient(s) could not be reached: stevep_5@zipmail.com on 2/2/2005 12:43 PM There was a SMTP communication problem with the recipient's email server. Please contact your system administrator. <My servername.domain #5.5.0 smtp;591 your host [my IP] is blacklisted by bl.spamcop.net. No mail will be accepted>" Now, I followed all the instructions of how to block my Exchange ...

RMS 2.0 Integration Approach
Hi everyone, I have Commerce Server 2009 in place and would like to integrate it with RMS2.0. What are some ways in general that an external system can integrate with RMS2.0? Regards. ...

importing email addresses from excel #2
Is there anyway to import emails in an Excel file into my Outlook address book? If you know the answer (how to do it, or it's not possible), pls send an email to me at: vnmar@verizon.net. thanks vince File->Import and Export->From a program->Excel. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After searching google.groups.com and finding no answer, vince asked: | Is there anyway to import emails in an Ex...

Saving email attachments #2
When saving email attachments we would like to save to a specified folder rather than the temp folder. We are using Outlook 2000 and Windows 2000 operating system. I would be grateful if anyone can help with this please. Thanks http://www.slipstick.com/config/attachfolder.htm --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After searching google.groups.com and finding no answer, Sue Jones asked: | When saving email att...

Moving CRM to new hardware #2
I'm in the process of planning a move of CRM 3 as we're refreshing our hardware. With that I am somewhat unsure in regards to the App install. Actually first I will say that all bits will be loaded onto 1 server just as I have it now. When I install CRM on the new box do I simply point it to the current OU for CRM? If so will this cause any issues for my existing instance as I do not want this to break. My plan would be to do a weekend where I would restore my DB's from a fresh backup to the new instance and then use deployment manager to specify the crm server. Thanks in a...

KB980248 failure to install.
SO, I have a Windows Server 2008 x86 machine that is dedicated to WSUS, no AV, no Office, basically, minimum Windows Server to support WSUS. KB980248 is failing to install. Original error code 80073712 but on a later attempt I have 80246007. This _was_ the only update waiting to install but suddenly I got the April 'Update readiness tool' offered and installed it, 980248 then installed fine. Only other thing I did was to restart in safe mode, rename windowsupdate.log to .old, restart normally. funny is all. On 2010-05-10 2:49 p.m., SuperGumby [SBS MVP] wro...

Customize CFileDialog #2
Hello I have a customized CFileDialog, and I wanted to get the change event from the combobox that maintain the filename cmb13. I tried serveral way, but i failed to get any event. Is there any way to get the event from the filename control. Thanks ...

HOw do i start outlook? #2
My outlook doesn't go past the check name screen? what do I do? Presumably it worked before? And the version is? You could try a repair using your Office or Outlook cd "mhabit" <mhabit@discussions.microsoft.com> wrote in message news:4E1B2630-9B20-444F-BF65-6B7E41638450@microsoft.com... > My outlook doesn't go past the check name screen? what do I do? The Check Name function is part of a Microsoft Exchange account. Are you trying to connect to a Microsoft Exchange server? Or your ISP? Joe "mhabit" <mhabit@discussions.microsoft.com> wrote i...

TOC Heading style 2
I am working in 2007 from someone else's doc from 2003 word. I will be saving in 97-2003. The styles shown in the home tab start Emphasis - Heading 1 - Normal - Strong (and others). I am trying to insert a TOC using the built in heading styles but I cannot see a Heading 2 or 3. How can I add the other headings to this group - is this a special style group added by the other author? TIA Dottie I opened this doc in 2003 word and was able to add the heading 2 there so I may have my answer for now. I would still like to know what I needed to do in 2007 word to make heading...

email failure!!
Can't send reply messages on craigslist. How do you normally send emails, via webmail? If so, who is your mail = service provider? Gary VanderMolen, Microsoft MVP (Mail) ------------------------------------------------------ "Jojo" wrote in message = news:5EC1863E-59BF-4C68-85BB-0AA131965204@microsoft.com... Can't send reply messages on craigslist.=20 "Jojo" <Jojo@discussions.microsoft.com> wrote in message news:5EC1863E-59BF-4C68-85BB-0AA131965204@microsoft.com... > Can't send reply messages on craigslist. ...

Charts #2
If I want to chart something between 50 and 80, how do I do it? The chart gives you 0 to 80. -- Richard Northern California Be Nice to Everyone Everyday Richard, Right click the axis, select format axis, under the scale tab change the minumum to your desired value (ie 50) Dan E "Richard Miller" <miller49@ix.netcom.com> wrote in message news:bhgcr3$4jm$1@slb0.atl.mindspring.net... > If I want to chart something between 50 and 80, how do I do it? The chart > gives you 0 to 80. > > -- > Richard > Northern California > > Be Nice to Everyone Everyday ...

Suming using 2 criteria
Sheet 1 has A B Bob Y Dan Pete Ted Y Mia Y ... Sheet 2 has A B C Bob 10 Q Dan 15 W Pete 8 E Ted 12 R Mia 22 T ... I want to sum(sheet2!B1:B100) where (sheet2!C="W") and (sheet1!B = "Y" where (sheet2!A = sheet1!A)) I know it can be done but I can't figure out the formula construct. Anyone? One way: =SUMPRODUCT(--(Sheet1!B1:B100="Y"), --(Sheet2!C1:C100="W"), Sheet2!B1:B100) In article <uyNN$euYFHA.3620@TK2MSFTNGP09.phx.gbl>, "Hall" <hall@garp.or...

Exchange 2003 Delivery failure notifications not going through
I have one user on Entourage 2008. When a message she sends is not delivered, she does not get a notification that it did not go through. I can see the messages sitting on the server in the local delivery queue but I have no idea how to get them to go where they need to go. any help would be appreciated. Stephanie ...

2 different Outlook.pst's in use ?
Hi, In Contacts I created sub folders to organize contacts. Today, I added some new contacts and changed some email addresses. While adding members (contacts) to a distribution list, I noticed some contacts do not show up in their folder or have old email addresses. I checked the sub folders, all contacts are present and up-to-date (as expected). I found 2 outlook.pst's to be in use, one in Local Docs and Settings, and one at the network share. It appeares above operations do not handle the same Outlook.pst ???? ;o I moved outlook.pst recently to a network share to have access at a 2nd...

Server Failure 131: A server failure occurred while attempting to.
I get the following error message every time I try to open Manager or POS and it doesn't allow me to continue. "Server Failure 131: A server failure occurred while attempting to read the current batch." Any idea on how to fix this? I use version 1.2. Thanks a lot. You probably have a problem with tender types. Have you been running any SQL Statements? There may be a Knowledge Base article on Customer Source regarding this, but you should probably either seek help from your reseller or open a support incident with MS. This is pretty deep into the RMS weeds. Is this happe...

SETUP BOOTSTRAPPER PROBLEM OFFICE 2000 prevents CD 2 installati...
I'm using Office 2000 Word, Excel and Access and have installed or reinstalled it from CD 1 three times on 8-month old XP Home Edition, no problem. Now I would like to install CD 2 programs and use Publisher. When CD 2 is inserted I get message, "MS Office setup bootstrapper has encountered a problem and needs to close. I can read some files on CD 2 but not the setup.hlp. I installed CD 2 on previous computer but never used programs. My latest reinstall of CD 1 was for purpose of getting a prompt to continue with CD 2, which didn't happen. I think when I installed CD 2 on o...

fill series #2
I have a worksheet that has 8 columns and 105 rows. Each cell gets the data from another sheet in the workbook. I can't seem to be able to fill down the formula the way I need it. The first row in the first column gets the data from 'Daily Data'!A8, the second row would be 'Daily Data'!A18, third row 'Daily Data'!A28, and so forth. So each row needs to skip down 10 rows to get the next value. How can I do this by using fill series or the fill handles? I've tried both and can't seem to get it to work. I don't mind entering the formulae in the first couple...

Inventory Reconciliation #2
Greetings, We have come across an issue that is related to Inventory Qty on hand.When we processed IV reconcilations, the inventory qty doubled and on running again,the total qty triples.On running the checklink, it notifies as Item on hand qty does not match with Purchase Receipts. We are using Manufacturing and IV is also tracked by LOTS. We had an opening balance as of 31st December 2007.in the Item stock Inquiry Window, the opening adjust is displayed with all the other transactions that followed.The main issue is that wrong qty is displayed in the BALANCE field. Any help on this mat...

Track 2
Hi guy, I've a doubt: I read around the Internet that Track2 of Credit Card are made up of 40 character (see here http://www.ded.co.uk/magnetic-stripe-card-details.html). Now I've a smart card reader and I'm reading my cards but the Start sentinel, End Sentinel and LRC characters are not displayed/readed. So I'm asking if they are truly written in the card? ...

How to add a vertical line to a Line Chart that aleady has 2 Y axi
I want to add a vertical line to a chart to call out a specific date. I have two lines and am using 2 Y axis due to the difference in values of the two data series. For a given X value I want a vertical line to appear on the chart to make it clear that data to the right of the line is AFTER a certain thing was done. How do I do this? http://peltiertech.com/Excel/Charts/AddLine.html - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ ISUTUBBS wrote: > I want to add a vertical line to a chart to ca...