|
William R. Price wrote: I still do not know if I am going in the right direction. There is very little mention of the actual interface with the hardware. I recently found some references to "I/O commands" like "READ_PORT_XXX" and "WRITE_PORT_XXX" where XXX can be UCHAR, ULONG, USHORT, ULONG64. However, most references indicate these are to be used in Windows CE
No these functions can also be used for your embedded XP project. You can think of these wrappers as the equivilent of the old DOS _outp, _outpw, _outpd[^] functions. You stated your device driver was implemented in Borland-C so your old code would have probably used outport[^] and outportb[^].
William R. Price wrote: Do I need something to tell WDF that the interface is an ISA bus and the interface is through I/O addresses?
If your PC104 card supports PnP ISA then when embedded XP boots the PnP manager will query the card and allocate the appropriate resources then send your driver a IRP_MN_QUERY_RESOURCE_REQUIREMENTS[^] request and ask your driver for its resource requirements which can be described in the IO_RESOURCE_REQUIREMENTS_LIST[^] struct which allows your driver to modify the resource requirements.
You will essentially need to write a PnP ISA device driver using WDF and create am INF file which contains the resource requirements. You could also write a co-installer and install the driver progmatically rather than use the INF file. More information here:
Device Installation FAQ[^]
William R. Price wrote: Does WDF initiate a callback to the "EvtDeviceAdd" immediately after the WdfDriverCreate? van Dooren stated, "The EvtDeviceAdd function will be called each time the system determines that a new device has been connected". If not, how do I "tell" the system that our passive board is present
If the Plug and Play manager has successfully detected your device the EvtDriverDeviceAdd[^] callback is fired. The PnP manager already knows about the existence of your device at this point. The callback is there for you to initialize any additional resources or interfaces.
Best Wishes,
-David Delaune
|
|
|
|
|
Hi Everyone,
I have a windows Application developed with .Net 2005 and C#. It communicates with a device using virtual COM Port. I use Windows XP Home and Prof. It works fine everywhere.
But recently I shipped the software to one of my client. There it creates problem. During its first run the software checks all COM Ports by sending specific command and where it finds proper response it detects that the device is attached to that Port. This is a regular process of the software. But, while checking the COM ports the application gets stuck after sending command to COM Port. And only way to close it is from Task Manager. This happens with 4 to 5 system, the client had tried.
I have also written Log files, there also after sending Command to com port, nothing is logged.
Note : No Anti Virus is installed there; Drivers are installed properly; Device is detected by the system when attached; displayed in device manager
Any suggestion or hint will be greatly appreciated...
Regards,
-SIFAR.
|
|
|
|
|
Sifar - 0 wrote: the software checks all COM Ports by sending ...
That seems to be a bad idea: COM ports can be busy, allocated, non-existing, or connected to special hardware (modem, infra-red, bluetooth,...).
Try the same "sending some command" using HyperTerminal to see it fail.
|
|
|
|
|
Is this a USB device using a virtual COM port? If so, here's what I do to find the COM port it's connected to.
NOTE: I'm not sure what the standard practice is for this, there may be a better way, but this was worked just fine for me so far. If anyone knows of a better, more robust way to do this, I'm open to suggestions.
You can determine which COM port the device is connect to by searching the registry under
HKLM\SYSTEM\CurrentControlSet\Enum\USB\VID_xxxx&PID_xxxx
where xxxx is the hex identifier for the VendorID and ProductID of the device. Inside this key is another subkey for each instance of the device, and then in the Device Parameters key you'll see PortName (I think, can't remember off hand exactly what it is). Anyway, the name of the COM port can be found here. You can iterate through each instance in the registry and attempt to open the .NET SerialPort object. If you successfully open the port, then the device is connected.
So you'll want to look for the key
HKLM\SYSTEM\CurrentControlSet\Enum\USB\VID_xxxx&PID_xxxx\<all subkeys="">\Device Parameters</all>
and read the PortName value from each instance.
foreach(string curPortName in portNames)
{
port.Name = curPortName;
try
{
port.Open();
break;
}
catch(InvalidOperationException ex)
{
}
catch(UnauthorizedAccessException ex){
}
}
You can check the MSDN documentation for how to read info from the Registry in C#.
Dybs
|
|
|
|
|
Thanx Dybs,
I had already tried this approach but it does not work under Windows Vista.
Actually, in Vista when you login as Administrator everything works fine. But with users other than Administrator it does not works. Vista creates different registry entries for othe Users.
I have found below solution :
I have used ManagementObjectCollection and ManagementObjectSearcher.
ManagementObjectCollection ManObjCollection;
ManagementObjectSearcher ManObjSearch;
ManObjSearch = new ManagementObjectSearcher("Select * from Win32_PnPEntity");
ManObjCollection = ManObjSearch.Get();
foreach (ManagementObject ManObj in ManObjCollection)
{
if (ManObj["Name"] == "Name You Are Looking For")
{
}
}
This has worked fine for me with XP and Vista, (Administrator and Non-Administrator) and it is fast also.
Hope this would help you further...
Regards,
-SIFAR.
|
|
|
|
|
Dear All,
How can I show the Windows Mobile circular waiting cursor from my form?
I'm sure it is very easy, but I've been looking for the solution form some time now without aany success.
Thanks in advance,
miguelji
|
|
|
|
|
I would try Cursor=Cursors.WaitCursor;
|
|
|
|
|
Tat was my first try, but in a Windows Mobile 6 device it doesn't work.
I'm probably doing something wrong, but it is so simple that I dont know what can be wrong.
miguelji
|
|
|
|
|
Yes, I think the cursor.waitcursor method may work in your scenario. Windows Mobile by default should display the waiting cursor for you. Is there something specific you are doing inside of your custom app? You didn't leave a lot of details.
|
|
|
|
|
Yes you are right, I was not leaving any detail.
I need to show the waiting cursor while my program performs a series of time consuming tasks. I've isolated the problem and created a WM6 (CF 3.5) application with a single form and a single button in it. Then I write the following code for the click event of the button (I use VB, but this would be the C# equivalent):
----------------------------------------------
Cursor c = default(Cursor);
c = Cursors.WaitCursor;
this.Refresh();
int I = 0;
int J = 0;
for (I = 1; I <= 10000000; I++) {
J = I * 3;
}
c = Cursors.Default;
this.Refresh();
----------------------------------------------
I run the programa, click the button and nothing happens, no cursor is displayed.
What Am I doing wrong here?
Thanks,
miguelji
|
|
|
|
|
Simply try this
Cursor.Current = Cursors.WaitCursor;
Cursor.Show();
and
Cursor.Current = Cursors.Default;
Cursor.Hide();
|
|
|
|
|
Thank you doananhtai!
It works perfect. It was easy, but thank you for being the one to tell how to do it.
Cheers,
miguelji
|
|
|
|
|
Dear All,
I have a critical application for which the performance has to be monitored.
I used the performance monitor in Windows 2003 server to log the data.
I have logged the counters of the Page file bytes and % processor time of the process / the service instance which has to be monitored along with the Processor % Processor time.
When I was analyzing the log I hae found a strange issue, the Processors % Processor time is 88 % but the instances % Processor time is 175 %.
Can any one tell me how this happens and how it is calculated?
Thanks a lot in advance.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Do you have a dual core system? If so the second number appears to be the percentage of time consumed relative to the capacity of a single core.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
M. J. Jaya Chitra wrote: When I was analyzing the log I hae found a strange issue, the Processors % Processor time is 88 % but the instances % Processor time is 175 %
88 percent of 200 == 176
Sounds like you have two processers and the process being performance monitored is multi-threaded.
Best Wishes,
-David Delaune
|
|
|
|
|
Dear Friends,
Yes, I am having the dual core processor.
Both of your post helped me a lot.
Thank you a lot for the timely reply and help.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Hi,
When using DeviceIoControl with METHOD_BUFFERED, will the buffer that windows allocate in kernel (the one that is the copy of user space), would it be taken from the non paged pool ?
I was looking for more specific documentation on the subject and did not find something explicit.
Thanks,
Shay
|
|
|
|
|
Hi Shay,
Yes, METHOD_BUFFERED will allocate the buffer from non-paged pool in the kernel address space. You can take a look at the diagram in the article Using Buffered I/O[^] to see an overview of the buffered I/O transfer method.
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks Dave, I ended up finding this link as well.
Shay
|
|
|
|
|
Hi everybody,
I am planning a PIN PAD and to get response from the device needs to send the command CE, does anyone know how can I do?
Thanks
|
|
|
|
|
|
Thanks for responding.
Try to explain better, I have a PIN PAD to achieve communication with the device, I will send a command more or less well <stx> CE0 <ext> <lrc>, the calculation of the LRC is on each byte without taking into account the first , ie C XOR E XOR 0 XOR EXT and sends me a number, however when sending information to the CE device I have to send as a command, not byte by byte like I'm doing now, but do not like
Thanks
|
|
|
|
|
OK, I misunderstood, I was thinking of more basic electronic stuff.
you did not and still don't tell the make and model, the kind of interface, etc. so how could anyone offer real help?
if the interface is serial (RS232C) you should use the SerialPort class, and transmit/receive byte arrays. if the interface is something else (e.g. USB) you would need the manufacturer's driver.
As far as the commands and encryption go, your first reference should also be the manufacturer's documentation.
If in the end you have a specific question or problem, show some code, and someone will be able to help you.
|
|
|
|
|
If you're right about that, is something more at the programming level. Well if necessary, the manufacturer's documentation does not offer me much, except what I have outlined here. I am communicating by serial interface. Hopefully someone can help me. When communication was achieved by sending a byte array, however, to verify the PIN PAD communication do not operate if you do not send as a command EC is, I sent
02 67 69 48 03 <lrc>
STX C E 0 ETX <lrc>
06 And I get a response (ACK) on the device but not recognized as an instruction, told me I should send a command such as CE, I suppose that as a single byte, but not how to do
|
|
|
|
|
you still are keeping everything a secret except that you now told the world it is using a serial port.
What is the make and model?
what documentation do you have?
do you have their sample code?
do you have examples of messages?
where did you get those STX, ETX, ACK inspiration?
does it say anything about ENQ?
does it say anything about hardware handshake lines?
etc etc.
and why do you send CE and call it an EC command?????
|
|
|
|