Re: Driver filter for Serial Port
From: Doron Holan [MS] (doronh_at_nospam.microsoft.com)
Date: 06/02/04
- Next message: Gary Chanson: "Re: Thread question"
- Previous message: pierre boisseau: "$$$$$$$$$$$$$$$$ pas mal"
- In reply to: Alex: "Re: Driver filter for Serial Port"
- Next in thread: Alex: "Re: Driver filter for Serial Port"
- Reply: Alex: "Re: Driver filter for Serial Port"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 1 Jun 2004 20:00:19 -0700
IoGetDeviceObjectPointer will send the IRP_MJ_CREATE for you.
d
-- Please do not send e-mail directly to this alias. this alias is for newsgroup purposes only. This posting is provided "AS IS" with no warranties, and confers no rights. "Alex" <Chipheo2k@hotmail.com> wrote in message news:uSDx03BSEHA.2216@TK2MSFTNGP12.phx.gbl... > Ura....... > I have found a useful link : > http://www.wd-3.com/archive/SerialAttachedDevices.htm > Maybe We forgot to call IRP_MJ_CREATE to Open the Comm Port. > I have modified some thing , as this Link , and now the SerialWrite has > finished well ( without infinite loop in WaitForSingleObject ). But.... The > result has not been got ... > Regards! > > > "Slobodan Brcin (eMVP)" <sbrcin@ptt.yu> wrote in message > news:#muDC6$REHA.3452@TK2MSFTNGP10.phx.gbl... > > OK. Then I have no idea except what I already said. Try controlling some > output pins directly to some state to see if you have at > > least control, if you do then only what remain for you is to set all > "valid" values. > > > > BTW: Try setting time outs for write just to see if it will ever timeout > write request. > > > > Regards, > > Slobodan > > > > "Alex" <Chipheo2k@hotmail.com> wrote in message > news:%23sCXWr$REHA.252@TK2MSFTNGP10.phx.gbl... > > > > > > Hi ! > > > I only manual debug by Watching the result in DbgViewer . I get start > with > > > WinDbg , but did not understand , it's completely complicated. > > > Regards! > > > > > > > > > "Slobodan Brcin (eMVP)" <sbrcin@ptt.yu> wrote in message > > > news:uJuwZX#REHA.3944@tk2msftngp13.phx.gbl... > > > > What I do not understand is how you use remote debugger if you have > only > > > one cable. > > > > > > > > Regards, > > > > Slobodan > > > > > > > > "Alex" <Chipheo2k@hotmail.com> wrote in message > > > news:etOhoT%23REHA.2976@TK2MSFTNGP10.phx.gbl... > > > > > Hi Slobodan ! > > > > > OK, thanks a lot ! > > > > > I will now answer your questions: > > > > > - I have a Null Modem cable with 9 legs . I have tested it by > > > communicating > > > > > in Windows Application , It works very well . > > > > > - I have no firewire . > > > > > I have tried to test like that : > > > > > - I run my Driver in My computer , and Run a Windows Application ( > user > > > > > mode ) in the other for Getting all bytes from Comm Port( my driver > > > sent ) > > > > > . I get a strange result : > > > > > In my driver , i write only one byte ( have tried with different > > > > > values ) . But In the Other computer , I always get 3 bytes result > ( all > > > af > > > > > them = 0 ) . > > > > > yup!. I don't understand , maybe i have set wrong parameters for > Comm > > > port > > > > > in my driver ??? > > > > > > > > > > Regards ! > > > > > Waiting for help from you ! > > > > > > > > > > > > > > > > > > > > > > > > > "Slobodan Brcin (eMVP)" <sbrcin@ptt.yu> wrote in message > > > > > news:O0rwFm8REHA.3716@TK2MSFTNGP09.phx.gbl... > > > > > > Alex, > > > > > > > > > > > > IoBuildSynchronousFsdRequest IoCallDriver, they always talk about > > > Driver > > > > > Lower in a Driver Chain. That is only matter of point of > > > > > > view. If you have PDO obtained trough IoGetDeviceObjectPointer > that is > > > > > enough for IoCallDriver to work. > > > > > > > > > > > > >and why IoBuildSynchronous , a not IoBuildAsynchronous > > > > > > > > > > > > And why not creating and filling that IRP manually? Do it as you > think > > > > > that it is good for your specific case . All these functions > > > > > > are there for us to use them. > > > > > > > > > > > > Slobodan > > > > > > > > > > > > BTW: > > > > > > Before you continue asking more and more questions. > > > > > > How many RS232 cables do you have? > > > > > > Do you have firewire? > > > > > > > > > > > > How do you debug your computer? > > > > > > Do you have started application for receive at all times on your > > > server? > > > > > > > > > > > > > > > > > > "Alex" <Chipheo2k@hotmail.com> wrote in message > > > > > news:e%23WGxa5REHA.1216@TK2MSFTNGP10.phx.gbl... > > > > > > > > > > > > > > Slobodan ! > > > > > > > I read some different documentations about > > > IoBuildSynchronousFsdRequest. > > > > > > > IoCallDriver , they always talk about Driver Lower in a > Driver > > > Chain > > > > > , > > > > > > > maybe We must attach it to a driver stack ? and why > > > IoBuildSynchronous , > > > > > a > > > > > > > not IoBuildAsynchronous ? > > > > > > > Best Regards! > > > > > > > Alex > > > > > > > > > > > > > > "Slobodan Brcin (eMVP)" <sbrcin@ptt.yu> wrote in message > > > > > > > news:eOpau$3REHA.324@TK2MSFTNGP10.phx.gbl... > > > > > > > > Examine DCB structure from Platform SDK you will find meaning > of > > > > > values > > > > > > > there. > > > > > > > > Although this won't help you since you said that this is > working > > > on > > > > > full > > > > > > > cable. > > > > > > > > > > > > > > > > BTW: Make sure that you are using/accessing right serial port > > > number. > > > > > I > > > > > > > don't see the reason for access denied error in one of your > > > > > > > > previous posts. > > > > > > > > > > > > > > > > If you have oscilloscope or Voltmeter or nice pass-through > with > > > leds > > > > > that > > > > > > > indicate state of you communication lines. You should > > > > > > > > drive manually trough codes some of handshake outputs to > certain > > > state > > > > > > > just to make sure that you are on the right post and that > > > > > > > > everything is ok. This is simple operations and do not require > > > proper > > > > > > > param initialization to work. > > > > > > > > > > > > > > > > Regards, > > > > > > > > Slobodan > > > > > > > > > > > > > > > > > > > > > > > > "Alex" <Chipheo2k@hotmail.com> wrote in message > > > > > > > news:erEtdf3REHA.2408@tk2msftngp13.phx.gbl... > > > > > > > > > Thank Slobodan ! > > > > > > > > > I do not use IOCTL_SERIAL_SET_HANDFLOW in my API User mode > > > > > Application , > > > > > > > and > > > > > > > > > it works normally , So i think , for a bit simplify ,I did > not > > > touch > > > > > it > > > > > > > in > > > > > > > > > my Driver too . In fact, I have tried to set HandFlow , but > I > > > could > > > > > not > > > > > > > > > find the apropriate things in file ntddkser.h and serial.h > , > > > so I > > > > > > > could > > > > > > > > > not do it ! My Cable is full ( 9 pins ) . So if you can , > pls > > > tell > > > > > me > > > > > > > some > > > > > > > > > about setting parameters for IOCTL_SERIAL_SET_HANDFLOW , I > tried > > > to > > > > > > > find, > > > > > > > > > but found nothing ....hic hic > > > > > > > > > Thanks you again . permit me to call you my TEACHER . > > > > > > > > > Regards! > > > > > > > > > Alex . > > > > > > > > > > > > > > > > > > "Slobodan Brcin (eMVP)" <sbrcin@ptt.yu> wrote in message > > > > > > > > > news:OSeYJR3REHA.3344@TK2MSFTNGP12.phx.gbl... > > > > > > > > > > What about handshake and your cable? > > > > > > > > > > IOCTL_SERIAL_SET_HANDFLOW? > > > > > > > > > > > > > > > > > > > > Idea about this if used is that receiving end can block > > > > > transmition of > > > > > > > > > data that it can't handle. Also this requires apropriate > > > > > > > > > > cable. If you don't have full cable or you don't want to > use > > > this > > > > > > > option > > > > > > > > > then you must disable this behaviour. > > > > > > > > > > > > > > > > > > > > Also start by receiving data. Make your server send data > > > > > constantly > > > > > > > and > > > > > > > > > try seeing in debuger what happens. > > > > > > > > > > > > > > > > > > > > Regards, > > > > > > > > > > Slobodan > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "Alex" <Chipheo2k@hotmail.com> wrote in message > > > > > > > > > news:ePrVL12REHA.3344@TK2MSFTNGP12.phx.gbl... > > > > > > > > > > > Hi Slobodan ! > > > > > > > > > > > pls help me ! > > > > > > > > > > > > > > > > > > > > > > I have set all necessary parameters for COM port, but > still > > > not > > > > > get > > > > > > > > > Result , > > > > > > > > > > > Write always in the wait state ... > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > //////////////////////////////////////////////////////////////////////// > > > > > > > > > > > > > > > > > > > > > > SERIAL_BAUD_RATE serBaudRate; > > > > > > > > > > > serBaudRate.BaudRate = SERIAL_BAUD_2400; > > > > > > > > > > > NTSTATUS statusBaudRate = SetBaudRate( &serBaudRate, > > > &ioStat, > > > > > > > pdo ); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > //////////////////////////////////////////////////////////////////////// > > > > > > > > > > > > > > > > > > > > > > SERIAL_LINE_CONTROL serLineControl; > > > > > > > > > > > serLineControl.Parity = SERIAL_EVEN_PARITY ; > > > > > > > > > > > serLineControl.StopBits = SERIAL_2_STOP; > > > > > > > > > > > serLineControl.WordLength = SERIAL_8_DATA ; > > > > > > > > > > > NTSTATUS statusLineControl = SetLineControl( > > > &serLineControl, > > > > > > > > > &ioStat, > > > > > > > > > > > pdo ); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > //////////////////////////////////////////////////////////////////////// > > > > > > > > > > > > > > > > > > > > > > #define MAXDWORD 0xffffffff > > > > > > > > > > > SERIAL_TIMEOUTS serTimeOuts; > > > > > > > > > > > serTimeOuts.ReadIntervalTimeout = MAXDWORD ; > > > > > > > > > > > serTimeOuts.ReadTotalTimeoutMultiplier = MAXDWORD ; > > > > > > > > > > > serTimeOuts.ReadTotalTimeoutConstant = MAXDWORD - 1; > > > > > > > > > > > serTimeOuts.WriteTotalTimeoutMultiplier = 0 ; > > > > > > > > > > > serTimeOuts.WriteTotalTimeoutConstant = 0 ; > > > > > > > > > > > NTSTATUS timeOutStats = SetTimeOuts( &serTimeOuts, > > > &ioStat, > > > > > pdo ); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > //////////////////////////////////////////////////////////////////////// > > > > > > > > > > > > > > > > > > > > > > UCHAR pBuffer[2]; > > > > > > > > > > > ULONG dwRead = 2; > > > > > > > > > > > statusWrite = SerialWrite( pBuffer, dwRead, &ioStat, > > > pdo ); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > NTSTATUS SerialWrite( const void *WriteBuffer, ULONG > > > NumBytes, > > > > > > > > > > > PIO_STATUS_BLOCK iosb, PDEVICE_OBJECT pdo) > > > > > > > > > > > { > > > > > > > > > > > if(!pdo) return STATUS_UNSUCCESSFUL; > > > > > > > > > > > NTSTATUS status; > > > > > > > > > > > PIRP irp; > > > > > > > > > > > LARGE_INTEGER startingOffset; > > > > > > > > > > > KEVENT event; > > > > > > > > > > > startingOffset.QuadPart = (LONGLONG) 0; > > > > > > > > > > > KeInitializeEvent(&event, NotificationEvent, FALSE); > > > > > > > > > > > DbgPrint("initial Event OK in Write "); > > > > > > > > > > > irp = IoBuildSynchronousFsdRequest( IRP_MJ_WRITE, > pdo, > > > > > > > > > > > (PVOID)WriteBuffer, NumBytes, &startingOffset, &event, > > > iosb ); > > > > > > > > > > > if(!irp) return STATUS_INSUFFICIENT_RESOURCES; > > > > > > > > > > > DbgPrint("Build IRP OK !"); > > > > > > > > > > > status = IoCallDriver( pdo, irp ); > > > > > > > > > > > DbgPrint("Waiting in SerialWrite..."); > > > > > > > > > > > if (status == STATUS_PENDING) > > > > > > > > > > > status = KeWaitForSingleObject( &event, Executive, > > > KernelMode, > > > > > > > FALSE, > > > > > > > > > > > NULL); > > > > > > > > > > > DbgPrint("Jumped out of Wait in SerialWrite !"); > > > > > > > > > > > if(status!=STATUS_SUCCESS) return status; > > > > > > > > > > > DbgPrint(" Write COMM successfully !"); > > > > > > > > > > > return iosb->Status; > > > > > > > > > > > > > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > NTSTATUS SetBaudRate( PSERIAL_BAUD_RATE serBaudRate, > > > > > > > PIO_STATUS_BLOCK > > > > > > > > > iosb, > > > > > > > > > > > PDEVICE_OBJECT pdo ) > > > > > > > > > > > { > > > > > > > > > > > NTSTATUS status; > > > > > > > > > > > PIRP irp; > > > > > > > > > > > LARGE_INTEGER startingOffset; > > > > > > > > > > > KEVENT event; > > > > > > > > > > > startingOffset.QuadPart = (LONGLONG) 0; > > > > > > > > > > > KeInitializeEvent(&event, NotificationEvent, FALSE); > > > > > > > > > > > DbgPrint("initial Event OK in SetBaudRate "); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > irp = IoBuildDeviceIoControlRequest( > > > > > > > > > > > IOCTL_SERIAL_SET_BAUD_RATE, > > > > > > > > > > > pdo, > > > > > > > > > > > serBaudRate, > > > > > > > > > > > sizeof(SERIAL_BAUD_RATE), > > > > > > > > > > > NULL, > > > > > > > > > > > 0, > > > > > > > > > > > FALSE, > > > > > > > > > > > &event, > > > > > > > > > > > iosb ); > > > > > > > > > > > > > > > > > > > > > > if(!irp) return STATUS_INSUFFICIENT_RESOURCES; > > > > > > > > > > > DbgPrint("Build IRP SetBaudRate OK !"); > > > > > > > > > > > status = IoCallDriver( pdo, irp ); > > > > > > > > > > > DbgPrint("Waiting in setBaundRate..."); > > > > > > > > > > > if (status == STATUS_PENDING) > > > > > > > > > > > status = KeWaitForSingleObject( &event, Executive, > > > KernelMode, > > > > > > > FALSE, > > > > > > > > > > > NULL); > > > > > > > > > > > DbgPrint("Jumped out of Wait in SetBaudRate !"); > > > > > > > > > > > if(status!=STATUS_SUCCESS) return status; > > > > > > > > > > > DbgPrint("SetBaudRate successfully !"); > > > > > > > > > > > return iosb->Status; > > > > > > > > > > > > > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > > > NTSTATUS SetTimeOuts( PSERIAL_TIMEOUTS serTimeOuts, > > > > > > > PIO_STATUS_BLOCK > > > > > > > > > iosb, > > > > > > > > > > > PDEVICE_OBJECT pdo ) > > > > > > > > > > > { > > > > > > > > > > > NTSTATUS status; > > > > > > > > > > > PIRP irp; > > > > > > > > > > > LARGE_INTEGER startingOffset; > > > > > > > > > > > KEVENT event; > > > > > > > > > > > startingOffset.QuadPart = (LONGLONG) 0; > > > > > > > > > > > KeInitializeEvent(&event, NotificationEvent, FALSE); > > > > > > > > > > > DbgPrint("initial Event OK in SetTimeOuts "); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > irp = IoBuildDeviceIoControlRequest( > > > > > > > > > > > IOCTL_SERIAL_SET_TIMEOUTS, > > > > > > > > > > > pdo, > > > > > > > > > > > serTimeOuts, > > > > > > > > > > > sizeof(SERIAL_TIMEOUTS), > > > > > > > > > > > NULL, > > > > > > > > > > > 0, > > > > > > > > > > > FALSE, > > > > > > > > > > > &event, > > > > > > > > > > > iosb ); > > > > > > > > > > > > > > > > > > > > > > if(!irp) return STATUS_INSUFFICIENT_RESOURCES; > > > > > > > > > > > DbgPrint("Build IRP SetTimeOuts OK !"); > > > > > > > > > > > status = IoCallDriver( pdo, irp ); > > > > > > > > > > > DbgPrint("Waiting in SetTimeOuts..."); > > > > > > > > > > > if (status == STATUS_PENDING) > > > > > > > > > > > status = KeWaitForSingleObject( &event, Executive, > > > KernelMode, > > > > > > > FALSE, > > > > > > > > > > > NULL); > > > > > > > > > > > DbgPrint("Jumped out of Wait in SetTimeOuts !"); > > > > > > > > > > > if(status!=STATUS_SUCCESS) return status; > > > > > > > > > > > DbgPrint("SetTimeOuts successfully !"); > > > > > > > > > > > return iosb->Status; > > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > > > And this is the result : > > > > > > > > > > > > > > > > > > > > > > Open COMM successfully ! > > > > > > > > > > > initial Event OK in SetBaudRate > > > > > > > > > > > Build IRP SetBaudRate OK ! > > > > > > > > > > > Waiting in setBaundRate... > > > > > > > > > > > Jumped out of Wait in SetBaudRate ! > > > > > > > > > > > SetBaudRate successfully ! > > > > > > > > > > > initial Event OK in SetTimeOuts > > > > > > > > > > > Build IRP SetTimeOuts OK ! > > > > > > > > > > > Waiting in SetTimeOuts... > > > > > > > > > > > Jumped out of Wait in SetTimeOuts ! > > > > > > > > > > > SetTimeOuts successfully ! > > > > > > > > > > > initial Event OK in Write > > > > > > > > > > > Build IRP OK ! > > > > > > > > > > > Waiting in SerialWrite... > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Best Regards! > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
- Next message: Gary Chanson: "Re: Thread question"
- Previous message: pierre boisseau: "$$$$$$$$$$$$$$$$ pas mal"
- In reply to: Alex: "Re: Driver filter for Serial Port"
- Next in thread: Alex: "Re: Driver filter for Serial Port"
- Reply: Alex: "Re: Driver filter for Serial Port"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|