Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - hidd_report_detach vs. hidd_report_attach: (1 Item)
   
hidd_report_detach vs. hidd_report_attach  
Hi,

On my QXN 6.3.0 SP3 I use hidd_report_attach to attach to input and output reports of a device like this.

==========
		int iInputAttachResult = (iInputReportResult == EOK) ? hidd_report_attach(phcHIDConnection, pdiHIDDevice, 
priInputReportInstance, 0, sizeof(CDeviceInstance *), &phrInputReport) : EOK;
		
		if (iInputAttachResult != EOK)
		{
			SetErrorCode(iInputAttachResult);
			break;
		}
		
		int iOutputAttachResult = (iOutputReportResult == EOK) ? hidd_report_attach(phcHIDConnection, pdiHIDDevice, 
priOutputReportInstance, HIDD_REPORT_FILTER, 0, &phrOutputReport) : EOK;
		
		if (iOutputAttachResult != EOK)
		{
			SetErrorCode(iOutputAttachResult);
			break;
		}
==========

Both attaches succeed. Then I get report length and determine it does not match one I expect. So I detect to detach 
reports and give up using device.

I do
==========
		if (phrOutputReport)
		{
			int iDetachResult = hidd_report_detach(phrOutputReport);
			verify(iDetachResult == EOK);
		}

		if (phrInputReport)
		{
			int iDetachResult = hidd_report_detach(phrInputReport);
			verify(iDetachResult == EOK);
		}
==========

Here first report detach succeeds and the second faults on SIGSEGV inside of libhiddi.so. And it does it exactly the 
same way regardless whichever report is detached first: input or output. So it looks like, a single call to the function
 detaches boths reports and then the second call crashes. Could someone check what could that be? In preliminary 
inputddk_iohid.pdf I have there are no special remarks for hidd_report_detach().

===============
(gdb) fr
#0  AttachHIDReportsWithReportInstances (phcHIDConnection=0x8066588, pdiHIDDevice=0x805f0b8, priInputReportInstance=
0x805f108,
    priOutputReportInstance=0x805f130, iInputReportResult=0, iOutputReportResult=0, pdiDeviceInstance=0x8065748) at xxxx
.c:7612
7612                    if (phrOutputReport)
(gdb) n
7614                            int iDetachResult = hidd_report_detach(phrOutputReport);
(gdb)
7615                            verify(iDetachResult == EOK);
(gdb)
7618                    if (phrInputReport)
(gdb)
7620                            int iDetachResult = hidd_report_detach(phrInputReport);
(gdb)

Program received signal SIGSEGV, Segmentation fault.
0xb8201e04 in ?? ()
(gdb) bt
#0  0xb8201e04 in ?? ()
#1  0xb8206aa8 in ?? ()
#2  0x07fc6da0 in ?? ()
#3  0x00000000 in ?? ()
(gdb)