Summary: | First four characters of serial device munged on open | ||
---|---|---|---|
Product: | [Applications] kandy | Reporter: | Daniel Bohling <dbohling> |
Component: | general | Assignee: | Cornelius Schumacher <schumacher> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Daniel Bohling
2005-03-15 20:33:29 UTC
The same here I'm also experiencing this problem on Kubuntu's kandy package. Everything seems to work fine on my Fedora Core 2 installation. Same here (Kubuntu 5.04 package) I looked into this and now I am confused... :) The bug is still present in the 3.5alpha1 release. The problem seems to be the following code in src/modem.cpp around line 194: const char *fdev = QFile::encodeName( (*prefs).serialDevice() ).data(); fdev contains the garbled string. I inserted the following code: printf("%s\n\n", fdev); printf("%s\n\n", (*prefs).serialDevice().latin1()); printf("%s\n\n", fdev); And this is the output (and kandy works with this): e/ircomm0 /dev/ircomm0 /dev/ircomm0 So... What am I missing here? Can someone please have a look at the following code (modem.cpp l.194). I think its wrong because QFile::encodeName() returns a QCString and QCString::data() returns a (const char *) Ptr. to the internal C-Array. But the QCString instance is deleted again immediately (isn't it?) thus invalidating the returned ptr. Right? const char *fdev = QFile::encodeName( (*prefs).serialDevice() ).data(); I will create a patch and attach it here. Maybe it is of help for someone. SVN commit 564537 by kling: Fixed the well-known problem with garbled device paths. Patch has been lying around on bugzilla for over a year. BUG: 39420 BUG: 45640 BUG: 47383 BUG: 96883 BUG: 104596 BUG: 101575 M +2 -1 modem.cpp --- branches/KDE/3.5/kdepim/kandy/src/modem.cpp #564536:564537 @@ -191,7 +191,8 @@ if ( !lockDevice() ) return false; - const char *fdev = QFile::encodeName( (*prefs).serialDevice() ).data(); + QCString dev = QFile::encodeName( (*prefs).serialDevice() ); + const char *fdev = dev.data(); if ( ( fd = ::open( fdev, O_RDWR | O_NOCTTY | O_NONBLOCK ) ) == -1 ) { emit errorMessage( i18n( "Unable to open device '%1'. " "Please check that you have sufficient permissions." ) |