grag38 / qextserialport

Automatically exported from code.google.com/p/qextserialport
0 stars 0 forks source link

Event driven mode on POSIX, and some other improvements #7

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have implemented the following things:
- event driven mode for POSIX systems (tested on Linux only). 
- implemented the errorString() function.
- qextserialenumerator is working on Linux
- Created a small dialog which is useful for port selecting andd settings
modify. 

Original issue reported on code.google.com by martonmi...@gmail.com on 22 Jul 2009 at 4:59

Attachments:

GoogleCodeExporter commented 8 years ago
man, i was looking for it... i will try it and see how it works... i would be 
really
happy if it works in linux!!! :) thanks!!

Original comment by jonathan...@gmail.com on 15 Aug 2009 at 9:27

GoogleCodeExporter commented 8 years ago
it does not work... i hope you can help me if im doing something wrong.. i 
applied
the patch, but it looks like you dont run it anywhere... :S please tell me if im
doing something wrong

Original comment by jonathan...@gmail.com on 15 Aug 2009 at 10:27

GoogleCodeExporter commented 8 years ago
Hello,

I have ported 2 applications to eventdriven and both of it is working fine.
These are only using the readyread signal not the dsrChanged. 
I have tried only with USB serial converters, but I guess it does not matter. 

I guess two reasons:
Are you opening the port / creating the port object with eventdriven method?
i.e. port = new QextSerialPort("/dev/ttyUSB1", QextSerialPort::Polling);

Are you linking your application with the convinent library?
I have a taken a lot of time to find out that the svn (debug) version is 
generating 
qextserialportd named libraries, not qextserialport.

Original comment by martonmi...@gmail.com on 15 Aug 2009 at 6:49

GoogleCodeExporter commented 8 years ago
Hello,

Yes, i tried both... btw, QextSerialPort::EventDriven, not Polling...

I have tried anything possible, and it wont work. I also tried using the 
correct lib,
and also adding the source code to my app, just to see if its works...

As I said, the event example wont work too... so i think that there is some 
type of bug.

If there is any chance to contact you via IRC or mail, I'd appreciate that.

Thanks in advance,

Original comment by jonathan...@gmail.com on 15 Aug 2009 at 8:27

GoogleCodeExporter commented 8 years ago
forget it, i have it working... it was an error from my end... thanks for your 
time!

Original comment by jonathan...@gmail.com on 15 Aug 2009 at 9:50

GoogleCodeExporter commented 8 years ago
:)
I hope Liam will merge this to the hg repo.

Original comment by martonmi...@gmail.com on 16 Aug 2009 at 12:17

GoogleCodeExporter commented 8 years ago
Hey - sorry for moving a bit slow, and thanks for the patch :)

Event driven reads for *nix are already implemented in the latest tip using 
QSocketNotifier, which makes the 
code considerably simpler (and doesn't involve any sleep()) so I'm inclined to 
stick with that.  

The error string method is nice - I think this can definitely be merged in.

There are a couple different patches for simple enumerator support on non-OS X 
*nix.  We'll have to review 
these and see which is most complete/portable.

I think I'll try to do a round of merges from the existing tickets and try to 
release another beta package before 
too long.  It's been a *long* time since the last release, so that might be 
helpful to get people using the latest 
code and making sure it's robust, etc.

Original comment by lst...@gmail.com on 16 Aug 2009 at 5:16

GoogleCodeExporter commented 8 years ago
hi guys,

         after I have added your patch and I got an error with fd was not declared in
the scope in the posix_qextserialport.cpp file. Please help and also I have my 
own
problem and hopefully people can help.

         I have used Qextserialport class in my project and works fine in Windows
then I moved it to Linux and errors came. I finally handled all of errors 
(mainly
library linking problem) and my program works EXCEPT there is no signal sending 
or
receiving from my program. I believed it is the problem of the Qextserialport 
class
and I found this site and find people have similiar problems. 

         Do people have a complete workable linux version Qextserialport source send
to me and I will be very apprepiate. If not, any experts can provide some ideas 
to
me..Thousand thanks!

Original comment by hkan...@gmail.com on 10 Sep 2009 at 8:25

GoogleCodeExporter commented 8 years ago
Can you confirm which version of the code you're using?  hg tip should be in 
good shape, I think.

Original comment by lst...@gmail.com on 10 Sep 2009 at 5:14

GoogleCodeExporter commented 8 years ago
hkantse, the problem i had with signals was from my end, not from 
qextserialport.
Anyway, you should try to use the last version of qextserialport, maybe the 
alpha (it
works in linux too), and there you will found simpe examples about how it 
works...

There is no signal/slot examples, but it's as simple as connect the signal
readyRead() to any slot... and that's all...

Original comment by jonathan...@gmail.com on 10 Sep 2009 at 10:50

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi again,

      My version is the alpha 1.2 and i used it in windows it works fine with my own
Qt testing program. Then when I transferred to Linux a few error happened and I
already fixed it. Now my situation is I connected my device in /dev/ttyS0 and 
my test
Qt program in linux will auto start this serial port and ready for me to send 
some
hex values to the device. It seemed that my device can not receive any 
signals.As a
result I have a few questions and hopefully people can help me to solve it.

     1. where is the lastest workable version of Qextserialport for Linux? Please
provide the source or the link to me.
     2. When I use the Qextserialport class, do I need to change or modify anything
in it to make it work ?
     3. I believe most of the people in their test program should use the below few
lines to open the serial port. Please help me to take a look whether it's right 
or not.
*************************************************************************
      comm = new QextSerialPort();
      comm->setQueryMode(QextSerialPort::EventDriven);
      comm->setPortName("/dev/ttyS0");
      comm->setBaudRate(BAUD38400);
      comm->setParity(PAR_NONE);
      comm->setDataBits(DATA_8);
      comm->setStopBits(STOP_1);
      comm->open(QextSerialPort::ReadWrite);
**********************************************************************
     4. As mentioned above, what is hg tip? I am new here..Sorry
     5. when debug or rebuild qextserialport project, it will create several .so.*
library files in subfolder build. one of them "libqextserialportd.so.1" is used 
by
the project and it did not copy to /usr/lib which I need to copy it manually. 
Why?
     6. Are there anything I should set in Linux terminal before I start using
Qextserialport class in Linux?

Thank you guys.

Original comment by hkan...@gmail.com on 11 Sep 2009 at 2:28

GoogleCodeExporter commented 8 years ago
hkantse, I'm currently using alpha version in linux and windows without any 
problem
or error to fix.

The lines you mentioned are right and i think these are enough to make it 
working.
Please note that in POSIX there is only the readyRead() signal, which is 
emitted with
any income byte, there is no write signals support in POSIX yet.

When you compile qextserialport you got a library, which you should copy to 
/usr/lib
and later that you should add to your .pro file:

LIBS  += -lqextserialport

which tells to qmake that you are linking that lib.

Besides that, nothing else is necessary, except the .pro defines which i think 
you
already have (if you look at examples) 

unix:DEFINES   = _TTY_POSIX_
win32:DEFINES  = _TTY_WIN_

if you continue having problems, you can contact me in #qt at freenode (irc) 
there
you can paste your code and we will take a look at it.

The class is so simple to use and you should have no problem when using it.

Original comment by jonathan...@gmail.com on 11 Sep 2009 at 4:34

GoogleCodeExporter commented 8 years ago
btw, you can contact me on irc as 'webbi'.

Original comment by jonathan...@gmail.com on 11 Sep 2009 at 4:58

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
thanks for your valuable advice. I believed I would like to talk to you 
directly on 
irc..but i am not using irc...can u talk to me through gmail??? My gmail 
account is 
hkantse@gmail.com

Original comment by hkan...@gmail.com on 11 Sep 2009 at 5:42

GoogleCodeExporter commented 8 years ago
Hi, I'm having problems with OSX port enumerator.
I use Mac OSX 10.5.8.
I build the project and copied it to /usr/lib

Building /examples/enumerator fails with following output:

Running build steps for project enumerator...
Starting: /usr/bin/qmake 
/Users/Andres/sds/serial/qextserialport/examples/enumerator/enumerator.pro -
spec macx-g++ -r 
Exited with code 0.
Starting: /usr/bin/make -w 
make: Entering directory 
`/Users/Andres/sds/serial/qextserialport/examples/enumerator'
g++ -headerpad_max_install_names -o enumerator.app/Contents/MacOS/enumerator 
obj/main.o -
F/Library/Frameworks -L../../build -L/Library/Frameworks -lqextserialport 
-framework QtGui -framework 
Carbon -framework AppKit -framework QtCore -lz -lm -framework 
ApplicationServices
Undefined symbols:
"_IOServiceGetMatchingServices", referenced from:
QextSerialEnumerator::scanPortsOSX(QList<QextPortInfo>&) in 
libqextserialport.a(qextserialenumerator.o)
QextSerialEnumerator::scanPortsOSX(QList<QextPortInfo>&) in 
libqextserialport.a(qextserialenumerator.o)
"_IONotificationPortCreate", referenced from:
QextSerialEnumerator::setUpNotificationOSX() in 
libqextserialport.a(qextserialenumerator.o)
"_kIOMasterPortDefault", referenced from:
_kIOMasterPortDefault$non_lazy_ptr in 
libqextserialport.a(qextserialenumerator.o)
"_IORegistryEntryCreateCFProperty", referenced from:
QextSerialEnumerator::getServiceDetailsOSX(unsigned int, QextPortInfo*)in 
libqextserialport.a(qextserialenumerator.o)
"_IONotificationPortDestroy", referenced from:
QextSerialEnumerator::~QextSerialEnumerator()in 
libqextserialport.a(qextserialenumerator.o)
QextSerialEnumerator::~QextSerialEnumerator()in 
libqextserialport.a(qextserialenumerator.o)
"_IORegistryEntrySearchCFProperty", referenced from:
QextSerialEnumerator::getServiceDetailsOSX(unsigned int, QextPortInfo*)in 
libqextserialport.a(qextserialenumerator.o)
QextSerialEnumerator::getServiceDetailsOSX(unsigned int, QextPortInfo*)in 
libqextserialport.a(qextserialenumerator.o)
QextSerialEnumerator::getServiceDetailsOSX(unsigned int, QextPortInfo*)in 
libqextserialport.a(qextserialenumerator.o)
"_IORegistryEntryGetPath", referenced from:
QextSerialEnumerator::getServiceDetailsOSX(unsigned int, QextPortInfo*)in 
libqextserialport.a(qextserialenumerator.o)
"_IOObjectRelease", referenced from:
QextSerialEnumerator::getServiceDetailsOSX(unsigned int, QextPortInfo*)in 
libqextserialport.a(qextserialenumerator.o)
QextSerialEnumerator::getServiceDetailsOSX(unsigned int, QextPortInfo*)in 
libqextserialport.a(qextserialenumerator.o)
QextSerialEnumerator::scanPortsOSX(QList<QextPortInfo>&) in 
libqextserialport.a(qextserialenumerator.o)
QextSerialEnumerator::scanPortsOSX(QList<QextPortInfo>&) in 
libqextserialport.a(qextserialenumerator.o)
"_IOServiceNameMatching", referenced from:
QextSerialEnumerator::scanPortsOSX(QList<QextPortInfo>&) in 
libqextserialport.a(qextserialenumerator.o)
QextSerialEnumerator::setUpNotificationOSX() in 
libqextserialport.a(qextserialenumerator.o)
"_IOServiceAddMatchingNotification", referenced from:
QextSerialEnumerator::setUpNotificationOSX() in 
libqextserialport.a(qextserialenumerator.o)
QextSerialEnumerator::setUpNotificationOSX() in 
libqextserialport.a(qextserialenumerator.o)
QextSerialEnumerator::setUpNotificationOSX() in 
libqextserialport.a(qextserialenumerator.o)
QextSerialEnumerator::setUpNotificationOSX() in 
libqextserialport.a(qextserialenumerator.o)
"_IONotificationPortGetRunLoopSource", referenced from:
QextSerialEnumerator::setUpNotificationOSX() in 
libqextserialport.a(qextserialenumerator.o)
"_IOMasterPort", referenced from:
QextSerialEnumerator::setUpNotificationOSX() in 
libqextserialport.a(qextserialenumerator.o)
"_IOServiceMatching", referenced from:
QextSerialEnumerator::scanPortsOSX(QList<QextPortInfo>&) in 
libqextserialport.a(qextserialenumerator.o)
QextSerialEnumerator::setUpNotificationOSX() in 
libqextserialport.a(qextserialenumerator.o)
"_IOIteratorNext", referenced from:
deviceDiscoveredCallbackOSX(void*, unsigned int)in 
libqextserialport.a(qextserialenumerator.o)
deviceTerminatedCallbackOSX(void*, unsigned int)in 
libqextserialport.a(qextserialenumerator.o)
QextSerialEnumerator::iterateServicesOSX(unsigned int, QList<QextPortInfo>&)in 
libqextserialport.a(qextserialenumerator.o)
"_IORegistryEntryGetParentEntry", referenced from:
QextSerialEnumerator::getServiceDetailsOSX(unsigned int, QextPortInfo*)in 
libqextserialport.a(qextserialenumerator.o)
QextSerialEnumerator::getServiceDetailsOSX(unsigned int, QextPortInfo*)in 
libqextserialport.a(qextserialenumerator.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [enumerator.app/Contents/MacOS/enumerator] Error 1
make: Leaving directory 
`/Users/Andres/sds/serial/qextserialport/examples/enumerator'
Exited with code 2.
Error while building project enumerator
When executing build step 'Make'

What I'm doing wrong?
Andres

Original comment by andres.v...@gmail.com on 27 Sep 2009 at 5:39

GoogleCodeExporter commented 8 years ago
Please don't hijack another issue.  Start a new one for a separate problem so 
we can track it separately.

Original comment by lst...@gmail.com on 27 Sep 2009 at 7:26

GoogleCodeExporter commented 8 years ago
Where does this issue stand currently? I don't think there's device enumeration
working on linux in the repo. What needs to be done to add that? It'd be great 
if
there was even just something basic working.

Original comment by bryant.m...@gmail.com on 23 Nov 2009 at 4:48

GoogleCodeExporter commented 8 years ago
This issue is for event driven mode on POSIX, which is implemented in hg tip.  
Response to enumeration q in 
other issue.

Original comment by lst...@gmail.com on 23 Nov 2009 at 9:44

GoogleCodeExporter commented 8 years ago
Should this be marked fixed then?

Original comment by bryant.m...@gmail.com on 4 Dec 2009 at 10:10

GoogleCodeExporter commented 8 years ago
There were a few extra items in the patches submitted originally which haven't 
been addressed, so I figured I'd 
leave it open.  

Although, I think adding a settings dialog is outside the scope of the serial 
port library, so I probably won't 
merge in those patches.  Closing this ticket now, after all :)

Original comment by lst...@gmail.com on 5 Dec 2009 at 6:29

GoogleCodeExporter commented 8 years ago
Hi,
How do I apply the patch?
I'm using Kubuntu 9.10

Thanks,

Muz

Original comment by zvi...@comcast.net on 27 Jan 2010 at 1:16