QTHID crashes under OSX lion when Funcube Dongle is Connected to the USB port #7

Closed
st0ne opened this Issue Jul 15, 2011 · 7 comments

Comments

Projects
None yet
2 participants
@st0ne

st0ne commented Jul 15, 2011

hi,

when the funcube dongle is connected to the usb port. then the qthid will close immediatly. i've tried with qt creator, to see where the problem is.

it says:
EXC_BAD_ACCESS
Could not access Memory

The error will be at line 468 of hidmac.c

i don't know where the problem is, my programing skill is not too good ;-)

here is the code:

/* Attach the new report object to the end of the list. /
if (dev->input_reports == NULL) {
/
The list is empty. Put it at the root. /
dev->input_reports = rpt;
}
else {
/
Find the end of the list and attach. */
struct input_report *cur = dev->input_reports;
while (cur->next != NULL)
cur = cur->next;
cur->next = rpt;
}

@csete

This comment has been minimized.

Show comment Hide comment
@csete

csete Jul 15, 2011

Owner

Hi,
Which version of OS X?

Owner

csete commented Jul 15, 2011

Hi,
Which version of OS X?

@st0ne

This comment has been minimized.

Show comment Hide comment
@st0ne

st0ne Jul 15, 2011

oh sorry, i forgot... it's osx lion GM.

st0ne commented Jul 15, 2011

oh sorry, i forgot... it's osx lion GM.

@csete

This comment has been minimized.

Show comment Hide comment
@csete

csete Jul 15, 2011

Owner

Ok, thanks. I will look at it when I get lion.

Owner

csete commented Jul 15, 2011

Ok, thanks. I will look at it when I get lion.

@st0ne

This comment has been minimized.

Show comment Hide comment
@st0ne

st0ne Jul 15, 2011

ok thanks, if you have some ideas now, i can test it ;-)

st0ne commented Jul 15, 2011

ok thanks, if you have some ideas now, i can test it ;-)

@csete

This comment has been minimized.

Show comment Hide comment
@csete

csete Jul 15, 2011

Owner

Sorry, I really have no idea whatsoever since I have never worked inside the hidapi files - they come from a different project written by somebody else.

Owner

csete commented Jul 15, 2011

Sorry, I really have no idea whatsoever since I have never worked inside the hidapi files - they come from a different project written by somebody else.

@st0ne

This comment has been minimized.

Show comment Hide comment
@st0ne

st0ne Jul 16, 2011

hmm,

can you say which project it is? maybe they have the same problem.

Am 16.07.2011 um 00:29 schrieb csete:

Sorry, I really have no idea whatsoever since I have never worked inside the hidapi files - they come from a different project written by somebody else.

Reply to this email directly or view it on GitHub:
#7 (comment)

st0ne commented Jul 16, 2011

hmm,

can you say which project it is? maybe they have the same problem.

Am 16.07.2011 um 00:29 schrieb csete:

Sorry, I really have no idea whatsoever since I have never worked inside the hidapi files - they come from a different project written by somebody else.

Reply to this email directly or view it on GitHub:
#7 (comment)

@csete

This comment has been minimized.

Show comment Hide comment
@csete

csete Aug 6, 2011

Owner

Analysis provided by Matt on the FCDevelopment group:

OK, so I've been playing with a small test harness that uses fcd.c and hidmac.c to do try various things.

Once I start making more than a couple of calls to various fcd functions I get segmentation faults.
I have tried compiling as both 32 bit and 64 bit and both have issues.

I began to think that the problem might be something to do with continually opening and closing the FCD,
using fcdOpen and fcdClose, so I modified fed.c so that fcdOpen reuses a previously opened connection and
fcdClose is a no-op.

My test harness now seems to run without issues every time.

I am no expert with IOKit but what I think is happening is that fcd.c opens the HID device in IOKit, quickly does
its thing and then closes the HID device. Sometime after this IOKit is coming along with a callback to hidmac.c
but the device has already been closed and this generates the segfault.

This feels to me like a bug in IOKit but as I say I'm no expert. It might be a bug in hidapi, I don't think it is a bug in
Qthid but it might be possible to mitigate the problem in Qthid by reusing the hid device rather than opening/closing
it for every query to the device.

Owner

csete commented Aug 6, 2011

Analysis provided by Matt on the FCDevelopment group:

OK, so I've been playing with a small test harness that uses fcd.c and hidmac.c to do try various things.

Once I start making more than a couple of calls to various fcd functions I get segmentation faults.
I have tried compiling as both 32 bit and 64 bit and both have issues.

I began to think that the problem might be something to do with continually opening and closing the FCD,
using fcdOpen and fcdClose, so I modified fed.c so that fcdOpen reuses a previously opened connection and
fcdClose is a no-op.

My test harness now seems to run without issues every time.

I am no expert with IOKit but what I think is happening is that fcd.c opens the HID device in IOKit, quickly does
its thing and then closes the HID device. Sometime after this IOKit is coming along with a callback to hidmac.c
but the device has already been closed and this generates the segfault.

This feels to me like a bug in IOKit but as I say I'm no expert. It might be a bug in hidapi, I don't think it is a bug in
Qthid but it might be possible to mitigate the problem in Qthid by reusing the hid device rather than opening/closing
it for every query to the device.

csete added a commit that referenced this issue Aug 13, 2011

@csete csete closed this Jan 1, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment