Hi Jason Thank you for your input, appreciated! Unfortunately, I did not write the firmware for the device. It uses feature reports as a 'bidirectional' report instead of input/output reports. I have already implemented a polling solution, with best guess of how long to wait for, and what the polling frequency should be. It works, but burns a lot of clock cycles in an already loaded system. Thanks again and good luck with the fireworks - be careful :)
BigBenDk
Posts
-
Reading and writing USB HID FeatureReports async. -
Reading and writing USB HID FeatureReports async.Hi, I am trying to communicate with a HID device, using feature reports. When using normal input and output reports, I use the
FileStream
to read and write reports. This works great, even with async communication. My problem is that I am using feature reports instead. This means using theHidD_SetFeature
andHidD_GetFeature
from the Windows hid.dll file. This also works, but theHidD_GetFeature
cannot be used async. When called it does not block until there is a report, so I end up having to poll when I expect there to be data. So I am looking for a way to do feature reports async, or have theHidD_GetFeature
method to block until there actually is a report. Any insight is appreciated! -
Pipping data to and from processYeah, I look at the OutputDataReceived event, and for a moment considered doing reverse text encoding on the string - but that was an absolute last resort :D The threading is handled internally, and has no contact to the GUI. You can se a sample of it at: http://bendtsen.net/sample.txt[^]
-
Pipping data to and from processHi Thank you for your quick response. I did some more work on it, and it looks like it was a threading issue. If I read the out stream in a diferent thread, it does not block. Im not sure why, but it works.
-
Pipping data to and from processWhat I need to do is something like this.
DataCruncher.exe < input.bin > output.bin
It is an application that is called in the command prompt. The input.bin file is piped in, and the result is outputed to output.bin. Works great. Now instead of starting the app from a command prompt, I need to call it from a C# app.ProcessStartInfo info = new ProcessStartInfo(location);
info.Arguments = BuildArgs();
info.RedirectStandardInput = true;
info.RedirectStandardOutput = true;
info.RedirectStandardError = true;
info.UseShellExecute = false;_process = Process.Start(info);
_toApp = _process.StandardInput.BaseStream;
_fromApp = _process.StandardOutput.BaseStream;The input is in binary format, and so is the output, so I used the basestream instead of the StreamReader. My problem is that it is blocking when im reading from the standard output.
while (true)
{
int read = _fromApp.Read(readbuffer, 0, readbuffer.Length); // <-- blocksif (read == 0)
break;//Do something with the data.
}It looks like it is blocking the stream until it has all the bytes to fill the readbuffer array. Is there something I should be aware of when read/writting to a process?
-
Advice on manipulating audio filesHi, I am currently looking at building a product that manipulates various audio formats. It has a few requirements Converting: FLAC -> WAV WAV -> FLAC WAV -> MP3 (various bitrate) WAV -> Vorbis (various bitrate) I am looking for high quality library's that can do the conversions. The MP3 conversion should support setting ID3 tags, including cover art. I have been looking at LAME, but it is not all to "C# friendly", and it does not support FLAC conversion. Any libraries I should be looking at, or other advices for achieving this? It does not have to be free, but is of cause preferable.
-
Debugging UDP on local machineThank you - I looked at the list. The problem with many of them is that it is not possible/hard to filter out other traffic. It is very confusing to debug in 500 packages, when 98% of them are irrelevant. I found "Ultra Network Sniffer"; it is perfect for the job. You can monitor any running application. And only packages transmitted to/from are shown. Unfortunately it crashes on Windows Vista :/ - had to move the project to an XP box.
-
Debugging UDP on local machineHi I am currently writing an application that communicates with a local program using UDP - but I need tools for debugging. Anyone knows a good "UDP sniffer", that can read local packages? Preferable with a filtering option to root out all existing communication. Thanks in advance!
-
Creating a document window in Visual StudioHi I'm trying to create a custom document in a Visual Studio Add-in. What i want to do is load a usercontrol, and show it as a normal document. Just like if you were editing a C# file. The content of the document, is not loaded from the project/solution, but using a webservice. The most obvious approach was creating a class, that inherits the IDocument interface, and implement the signatures. There after add it to the document collection. This is where it breaks - I can't add an IDocument object, only a guid. Any thoughts on how to accomplish this? All help is welcome! :omg:
-
UserControl as document in Visual StudioHi I am creating an addin for visual studio. It uses WCF services, and I would like to edit the objects as documents. This is somewhat similar to what the client of the Team Foundation Server does. I have created the toolboxes I need - partialy based on this two Code Project articles: http://www.codeproject.com/csharp/cpbrowser.asp and http://www.codeproject.com/WCF/WCF\_FileTransfer\_Progress.asp For the documents I have made a ToolWindow in the same way, by setting the Floating property to false. It is close to what I want. But it has drawbacks. I can't set the document as "changed", and therefore i can't use the save button, and the undo/redo, print buttons are also disabled. What I really want is to load a UserControl as a document - this seems like simple task, but I am lost here. I looked at the VSIP SDK - it has samples that are close, but they seem bound to specific fileextensions/files. When I load from a service, I don't have any elements in the loaded solution/projects. I can't believe it is that complicated.
-
Reading configurations from a Visual Studio Add-inI have created an add-in to Visual Studio 2005, and I would like to use a WCF service. This requires a configurationfile with the configured endpoints. Normally I would create an app.config, and let visual studio build it to [appname].config in the output directory and it would work. But when i try to access the services from the add-in, i get a configuration error that the endpoints are not configured. How do i make it open the configuration for the add-in, and not for Visual Studio? With kind regards Soren Bendtsen
-
Reading configurations from a Visual Studio Add-in [modified]I have created an add-in to Visual Studio 2005, and I would like to use a WCF service. This requires a configurationfile with the configured endpoints. Normally I would create an app.config, and let visual studio build it to [appname].config in the output directory and it would work. But when I try to access the services from the add-in, i get a configuration error that the endpoints are not configured. How do i make it open the configuration for the add-in, and not for Visual Studio? With kind regards Soren Bendtsen
-
Advice on WCF configurationsHi Pete Thank you for the speedy reply! Is it really that simple? - I looked at message security configurations, that seemed far more complex. E.g http://msdn2.microsoft.com/en-us/library/ms789011.aspx Do you know how to specify the credentials on the client side, if entered manually?
-
Advice on WCF configurationsHi I have spent the last few days surfing the net on WCF and on how to configure it, but I can't seem to find the correct solution. I have made an application, that is used on internal lan (Client/Server). I would like to use the existing windows logon, and integrate with the local domain controller. Additional I would like to have the option to enter an other windows logon, than the one the user is currently logged on with. Security is not that big a concern, because all traffic is internal and the information is not very sensitive - but of cause it should not be ignored. I would like to avoid having to setup SSL and manage certificates - It makes it harder to deploy, and if I have to purchase a certificate for every customer, it raises the price of the product. How would you recommend setting up WCF in this scenario?