I'm working with the next tutorial: How to write your first USB client driver.
And I've got a problem with compiling a project, I've got the next error:
I was trying to do the steps closely to the description in tutorial, but always got the error above, when compiling the project.
Also, I've tried to search, but didn't find any useful information.
Possible additional info, which might help you to give me a piece of advice:
INF-file: http://pastebin.com/71d6bbQm
Using Windows 10, latest WDK and VS2015
Have started exactly USB User-Mode Driver template as was mentioned in tutorial
Basically, the error is saying you're trying to create a class that already exist, which is the USBDevice class. Since you're trying to create a new USB client driver, you can go ahead and delete the Class definition section.
However, if you are trying to create a new class, then make sure that the class name and GUID don't already exist in this list: System-Defined Device Setup Classes Available to Vendors.
If you want to learn more about INF files, check out this article: INF Files for Bears of Little Brain.
Related
I'm working on a custom Linux BACNet compatible device. I've stopped my search on BACNet Stack.
I've been able to build from the latest version on github, also been able to test both readprop and writeprop with server from the build directory (examples provided). I had to edit the writeprop to make it properly work, but this is not the point here.
Now, I'm wondering what is the good way to implement a device that will answer to read-property requests. In the server example, there is one handler that could be the way :
apdu_set_confirmed_handler(
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
but I'm confused when I go into source of h_rp.c I see the function Device_Read_Property is called, which make more sense to overload? This function seems to belong to device.h.
So, should I overload Device_Read_Property ? Seems like the library is missing a device implementation comprehensive example.
I am a game developer working on a serious game. I have some data simulation taking place as a result of a MATLAB (Simulink) model, that was created by someone who left the team now. All this data simulation generates useful data and allows me to query and check variables when needed. I needed to build a game using this model. So I used the Simulink Code generator to generate the code for my model in C++. This is native C++ and is procedural. The volume of code is high for me to rewrite it, hence I am refraining from doing that. I need to use this code in Unity3d, the engine I am developing the game on.
Long story short. I need to load a native C++ dll (generated by Simulink) in Unity3d.
What I tried:
I tried using the Unity3d's native plugin API. I have pro version and it doesn't seem to detect the dll, and just throws exceptions. I am using the extern keyword to make the required variables public, still no luck.
I tried following this tutorial (http://blogs.abo.fi/alexeevpetr/2011/11/18/simplified-building-simulink-generated-c-code-in-visual-studio/) , but it throws errors and doesn't build, maybe that's because of the version of MATLAB.
I also considered using a wrapper, however that would imply me rewriting most of the code again.
I've never used native dlls in Unity, but you could always try one of the several code bridging methods to call C++ code from C#, I guess. So how about writing a C++/CLI wrapper? It won't force you to rewrite anything. It gives managed access to your unmanaged code, and it's a useful technique to learn anyway.
You should be able to load your native plugin into Unity3D, even if it requires MATLAB libraries (Just make sure they're also in the plugins directory). I recently answered a similar question around this, as it can be fairly tricky to get right. I would suggest you check it out HERE, and modify your question with specific errors and problems you're having trying to loading the native code.
From Geomorillo on U3d forums:
Before anything,
1) install Visual C++ Studio Express 2010 we need the sdk from .NET for compiling, (NOTE:Maybe you can use visual C# express instead for compiling because it require the .NET sdk but no sure )
2)You must setup matlab with the command "mbuild - setup", and choose the compiler Microsoft Visual C++ Studio Express 2010
3) you must have a function already created and saved to a ".m" file mine is called mycos.m here is its contents:
function a=mycos(b)
a=cosd(b);
end
where "a" is the return parameter and "b" the input parameter, it is important to know how many return parameter you have in this case 1 (see step 12)
4) use the "deploytool" command, a window should open, name the project "simplelibs" any name should do, choose a location c:\matlab\simplelib, choose in type .NET Assembly, OK
5) After that new options int form of tabs should appear to the right of your window, the Build and Package Tabs.
In the Build tab you should add a class with the Add class option, it will automaticly was named Class1, but i changed it to Myclass, here you can add your functions to your class using Add files, i've added mycos.m
6) You should have noticed 3 buttons next to the project name, click the 3rd one with the shape of a nut, go to Settings a new window should appear, go to .NET tab and in the Microsoft Framework choose 3.5 to make sure you are using .net 3.5 for compiling(required for unity3d)
7) we are ready to compile, do so with the 1st button, it should take a while....
8) After compiling without errors, the files are in the distrib folder inside your project path , open unity and create a new project. copy the 2 dlls into the root inside unity.
9) Locate de directory "dotnetbuilder" inside "c/.../matlab/../toolbox" copy or drag it all its contents to your unity project.
10) We need the a dll MWArray.dll because when compiling our libraries matlab wraps our function in an Array and it use its methods to access our functions im not gonna explain this, google it please, normally it can be found inside matlab installation dotnetbuilder/bin/win32/2.0/ but since you have copied it to unity dont copy again, when using this mwarray i found a bug with monodevelop in this library so i had to decompile it and fix the bug i've to recompile it again :) you you can download this file here https://dl.dropbox.com/u/6716823/MWArray.dll and replace the one found inside unity project (do not!!! replace the original from matlab directory)
11) create a c# script and asign it to main camera or any object in scene
here is its contents
using UnityEngine;
using System.Collections;
using System;
using MathWorks.MATLAB.NET.Arrays; // import from MWArray.dll
using simplelib;
public class myMatlab : MonoBehaviour {
void Start () {
simplelib.Myclass g = new simplelib.Myclass();
Debug.Log(g.mycos(1,95).GetValue(0));
}
}
12) g.mycos(1,95); // remember when i said it wraps your function !!! the first parameter is the number of parameters returned from our matlab function in this case 1, the 95 is the parameter we want to send to our function, we get an array we can access it with .GetValue(0)
13) play and enjoy
This is an example with a simple function so i dont know if it will work with a more complex program
i hope this works for you
Question Intro
I'm running an opencv project in Visual Studios 2010 and have implemented cuda support (refer to my previous question for precise info on my set-up). All cuda-functionalities are working fine - to the best of my knowledge - and are indeed improving speed on the image processing.
However, I now also wanted to attemp to speed up the video-writing function in this project by replacing the current cv::VideoWriter with the gpu::VideoWriter_GPU function. The reason for this is that the cv::VideoWriter seems to somehow cause processes running outside of the scope in which the VideoWriter is called to be slowed down, resulting in images available at the DirectShow driver being dropped by the VideoCapture-function, hence messing up an algorithm I've implemented.
Problem
To attempt to solve this issue, I've now replaced the VideoWriter-calls with VideoWriter_GPU-functionality (and corresponding syntax), but when I run my project (Compile & Run in Debug-mode), I get the following error-message (directly originating atthe calling of gpu::VideoWriter_GPU):
OpenCv Error: The function/feature is not implemented (The called functionality
is disabled for current build or platform) in unknown function, file
c:slave\builds\wininstallermegapack\opencv\modules\gpu\src\precomp.hpp, line 131.
and the program then ends with
code -529697949 (0xe06d7363)
I've purposely currently not included any of my code because the error-message originates so clearly from the call to the gpu::VideoWriter_GPU, which is making me think it's not a coding or syntax problem. (Please comment if you feel my code is necessary for answering this question.
My steps so far
I miss the natural gift of understanding what precisely this message means or how to interpret it. Does my opencv v2.4.4 simply not support what I want...? Does this function simply not work on my windows 7, 64bit system...?
I've checked out as many available google-hits I could find (relating to this error message and combinations of searchterms like "opencv, gpu, VideoWriter_GPU, disabled for current build") but have not understood what the problem is or how to solve it.
Corresponding header-file and error message can also be found here.
This post and this post suggest the error message is trying to tell me that opencv simply does not provide the option of using the function or functionality I am aiming to use. Or maybe even that cuda is not at all supported.. But that's all against my experience as every single opencv gpu-function I've tried to use has seemed to work fine.
Question
Could someone please explain to me why this is not working for me, and more importantly share with me what I should do to make the VideoWriter_GPU work?
Many thanks!
Maybe this link can give you a little idea of what the problem is: VideoReader_GPU not available, but built with NVCUVID?.
It seems to be that the problem is the CUDA_DISABLER var.
I've got some native C DLLs which I'm calling from a Managed C++ Class library ("Rem"). In the "Rem" class library I've got one native C++ class (api) and one managed C++ class (API).
The managed class (API) is called from a C# console application for now (will be used in a web application later).
When debugging I can step through my native code just fine.
My problem is that when I'm debugging, I can't see the values of any variables other than simple types that are locally declared.
Function parameters are not available in the debugger and if I try to add them as a Watch it just says "error: identifier 'schema_name' out of scope" ('schema_name' is the variable name)
Any structs just show the value "{...}", both in the quick watch and the Watch-window.
If I try and add a watch to a field in a struct I get the value "error: 'entryList.numItems' does not exist"
Stuff I've tried:
I've tried creating a Console application in Managed C++ and debug from that, same thing.
I tried unchecking the
Tools->Options->Debugging->General->Managed C++ Compatibility Mode, then I couldn't step into the code at all (no symbols loaded for the breakpoints)
In the C# console app project, I've gone into Properties->Debug and checked "Enable native code debugging" (and unchecked it)
In the C++ class library I've gone into Properties->Debugging->Debugger Type and tried "Mixed", "Native", "Managed" and "Auto".
Any suggestions as to what I'm doing wrong?
I guess you are using Visual Studio 2012 Update 2. In that case - this is a known bug with Update 2:
https://connect.microsoft.com/VisualStudio/feedback/details/783004/children-cannot-be-evaluated-on-c-cli-after-vs2012-update-2
Be careful though, the "workaround" of uninstalling Update 2 will leave you with a broken Visual Studio as seen in this bug-report (yes, Update 2 is broken):
https://connect.microsoft.com/VisualStudio/feedback/details/785396/uninstalling-vs2012-update-2-and-repair-of-vs-results-in-atl-files-missing
In case you are not using Update 2 this might not be the correct answer but it could help others who experience exactly this problem using Update 2.
I'm trying to write a dll plugin for Winamp. I'm using Microsoft Visual Studio 2008 and Microsoft SAPI 5.1. I created the interface window using Windows Form (System::Windows::Forms::Form).
I tried to use SetNotifyWIndowMessage(), but the method is never called when I speak to the microphone. So I tried using SetNotifyCallbackFunction(), but I got a compile error saying that I should use '&' in front of the method name in the parameter. However, when I add the '&', I got another compile error saying that i can't take the address of the method unless creating delegate instance.
What should I do? Someone please help me..
Well, as indicated, you need to create a delegate instance to wrap your callback. But don't go there, SAPI 5.1 is quite outdated. Updates are no longer shipped because the .NET framework has a very nice wrapper for it. Check out the System.Speech.Recognition namespace and the SpeechRecognitionEngine class. You'll want to use the SpeechRegonized event. You'll find plenty of code samples in the MSDN Library pages for the class.