www.8devices.com
View unanswered posts | View active topics It is currently 29 Mar 2024, 11:04



Reply to topic  [ 3 posts ] 
 USB2CAN receiving handle exposure 
Author Message

Joined: 05 Sep 2014, 09:03
Posts: 2
Hello,

We had a USB2CAN converter to add to our project and received the v1.0.6 DLL files but I made some changes (as you can see in lines 982 and 1028 of usb2canobj.cpp ) that has the benefit that an external reading thread could wait on m_receiveDataEvent before calling CanalReceive function, similar to Peak USB to CAN driver interface provides a receive handle, otherwise I have to spawn another thread that calls CanalBlockingReceive and my own manual reset event so I'm proposing to export it from usb2can.dll.

Also to avoid setting the event outside of the mutex section since a reading could occur just after m_receiveMutex was released, I moved SetEvent in the protected area for thread workThreadReceiveData as you can see in lines 1466 and 1474.

I attached the patch files for "v1.0.7" that you could use to see the differences between the version 1.0.6 I’ve got from 8devices and my proposed changes, there are some minor modifications and I provided project files to compile it with Visual C++ Express 2008 (should be easy to import in other Express editions) at following link: https://dl.dropboxusercontent.com/u/105 ... v1.0.7.zip

I also provided a fix to call CanalOpen from multiple processes to not allow opening the driver again which was breaking functionality of the first process that opened it, by using a shared mapped memory file and a global mutex.

It would be great if you could review the changes and let me know if you think they are acceptable, then to merge them in your release trunk, in the mean time I will revert our project to the original files (v1.0.6) that we received from 8devices.

Best regards,
David.


Attachments:
usb2can_dll_proposedv1.0.7.zip [22.24 KiB]
Downloaded 209 times
05 Sep 2014, 09:13
Profile

Joined: 05 Sep 2014, 09:03
Posts: 2
Hello,

The changes mentioned in previous post have been accepted in the VSCP project at https://github.com/grodansparadis/vscp_software. A fork is available at https://github.com/davidlcamlin/vscp_software and a merge request have been sent for a newer version to VSCP, v1.0.8. There was an occasional problem on closing port that the application would block and the reason is CancelIo was called in wrong thread. I provided the project folder (built with VS2013 Express) in the attachment for your reviewing.

Best regards,
David.


Attachments:
usb2can_dll_v1.0.8.zip [45.34 KiB]
Downloaded 174 times
22 Dec 2014, 10:14
Profile

Joined: 11 Jun 2014, 14:45
Posts: 135
Thank you for your input :)


23 Dec 2014, 07:50
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Protected by Anti-Spam ACP Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.