I have ofSerial running ok in my project, but when you close the app (with escape) the program crashes with a windows ‘im sorry your program crashed box’. I’ve commented out all my code, slowly turning stuff back on in code until I found it was the serial.
Also, I tried running serialExample (precompiled sample with 0.03) and it crashes before starting up:
b) the demo app (0.03 -> vs -> serial -> release) crashes when you try it -
about (b) please just recompile it, I guess there was something that got missed. If I rebuild it it’s fine. it’s likely a build that we missed, nothing to worry about.
about (a), ok , I think it’s the same as the quicktime crashing at the end, which is that I might be doing something aggressive at the end in terms of memory deallocation that it’s unhappy about. soon we will look at ending procedures. Seems to be only happening with VS builds for now, so haven’t noticed them on other compilers. if you feel like poking around, you can try commenting out:
– ofSerial::~ofSerial()
or
– ofSerial::close()
and see if that helps - you might narrow down a specific call that is crashing at the end.
I have been noticing more problems with ofSerial, I dont know if they are related.
Even though the comport (COM4) is not used by another program, when I try to open in ofw it says not available. When I try it in comDebug (as mentioned earlier in this post) it works, then I go back to OFW and port4 works.
Very off
Also, serialPort.enumerateDevices() crashes my application. I can’t run serialExample unless this line is commented out.
can you try commenting out parts of enumerateDevices(), to see why it crashes? can you try running it in debug and release?
can you download the dev-c++ version and see if there are any differences?
it doesn’t crash for me with 1 or 2 arduinos plugged in, so hard to say, but I have to admit it’s not a well tested part of the core so feedback is really appreciated.
I’d be interested to know if you get to these lines before the crash:
// Search device set
hDevInfo = SetupDiGetClassDevs((struct _GUID *)&GUID_SERENUM_BUS_ENUMERATOR,0,0,DIGCF_PRESENT);
SetupDiEnumDeviceInfo(.....)
SetupDiGetDeviceRegistryProperty(.....)
you can start just putting printfs everywhere
printf(“a \n”);
…
printf(“b \n”);
Even though the comport (COM4) is not used by another program, when I try to open in ofw it says not available. When I try it in comDebug (as mentioned earlier in this post) it works, then I go back to OFW and port4 works.
I really don’t know - if we can get enumerate devices to work we can get a better sense of what the code sees as available devices.
it works for me so it’s super hard to debug on my end, but just keep trying different things and we’ll get it.
weird, I think you have a port which is not COM1, COM2 - and that’s why it’s crashing.
this code will skip the offending port (or ports) and should output ports that it really can digest. (like COM1, COM2, etc)
another test:
char * begin = NULL;
char * end = NULL;
begin = strstr((char *)dataBuf, "COM");
if (begin != NULL){
end = strstr(begin, ")");
if (begin){
if (end){
*end = 0; // get rid of the )...
strcpy(portNamesShort[nPorts], begin);
}
}
if (nPorts++ > MAX_SERIAL_PORTS) break;
}
}
i++;
do you have anything besides a normal serial port or arduino, like a usb->serial adapter?
Yeah I’m using a usb serial device, i either get COM15, COM4 or COM9. My laptop doesn’t even list com1/com2.
The changes you made stop it crashing now, although it lists no devices.
Been coding ofw all day, off to sleep now to pick this up again tomorrow. Its not urgent for my current situation, but would be good to fix if there is a bug.
strange, because this system should work w/ com whatever, like COM20, COM4, etc. can you let me know the model # of the product, I will investigate. the funny thing is that this code, I think, comes from a usb->serial adapater company
can you try this:
printf("the computer thinks I am called %s \n", (char *)dataBuf);
begin = strstr((char *)dataBuf, "COM");
the more we can learn about this the better for everyone. today I’ll get back w/ my arduino - . currently, it looks like it’s locking on a weird name or something like that. there are some old school text parsing things there that don’t look so safe, so we will replace them, but I’m very curious to understand the crash.
ok weird, I think we are not getting good values for this:
SPDRP_FRIENDLYNAME
from the device, and that is causing the crash…
today I am going to read about “SetupDiGetDeviceRegistryProperty” and SPDRP_FRIENDLYNAME and I’ll send you some other code to try. I’ve seen serial port enumeration 7 different ways !! : http://www.naughter.com/enumser.html