summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/opietooth2/OTDevice.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/opietooth2/OTDevice.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTDevice.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/settings/networksettings2/opietooth2/OTDevice.cpp b/noncore/settings/networksettings2/opietooth2/OTDevice.cpp
index 62f17a0..c6f7d5e 100644
--- a/noncore/settings/networksettings2/opietooth2/OTDevice.cpp
+++ b/noncore/settings/networksettings2/opietooth2/OTDevice.cpp
@@ -82,49 +82,49 @@ bool OTDevice::attach(){
82 // we need to start this in 'dontcare' mode because 82 // we need to start this in 'dontcare' mode because
83 // if qpe exists we want the hci to keep running 83 // if qpe exists we want the hci to keep running
84 if( ! m_hciattach->start( OProcess::DontCare, 84 if( ! m_hciattach->start( OProcess::DontCare,
85 OProcess::AllOutput 85 OProcess::AllOutput
86 ) ){ 86 ) ){
87 emit error( tr( "Could not start hciattach" ) ); 87 emit error( tr( "Could not start hciattach" ) );
88 delete m_hciattach; 88 delete m_hciattach;
89 m_hciattach = 0; 89 m_hciattach = 0;
90 return FALSE; 90 return FALSE;
91 } 91 }
92 } 92 }
93 93
94 return TRUE; 94 return TRUE;
95} 95}
96 96
97bool OTDevice::detach(){ 97bool OTDevice::detach(){
98 98
99 if( needsAttach() && m_hciattachPid ) { 99 if( needsAttach() && m_hciattachPid ) {
100 if( m_hciattach ) { 100 if( m_hciattach ) {
101 delete m_hciattach; 101 delete m_hciattach;
102 m_hciattach = 0; 102 m_hciattach = 0;
103 } 103 }
104 104
105 if( kill( m_hciattachPid, 9) < 0 ) { 105 if( kill( m_hciattachPid, 9) < 0 ) {
106 owarn << "could not stop " << errno << oendl; 106 odebug << "could not stop " << errno << oendl;
107 emit error( tr( "Could not stop process" ) ); 107 emit error( tr( "Could not stop process" ) );
108 return FALSE; 108 return FALSE;
109 } 109 }
110 m_hciattachPid = 0; 110 m_hciattachPid = 0;
111 emit isEnabled( m_deviceNr, 0 ); 111 emit isEnabled( m_deviceNr, 0 );
112 m_deviceNr = -1; 112 m_deviceNr = -1;
113 } 113 }
114 114
115 return TRUE; 115 return TRUE;
116} 116}
117 117
118bool OTDevice::isAttached()const{ 118bool OTDevice::isAttached()const{
119 return ! needsAttach() || m_hciattachPid != 0; 119 return ! needsAttach() || m_hciattachPid != 0;
120} 120}
121 121
122bool OTDevice::checkAttach(){ 122bool OTDevice::checkAttach(){
123 if( ! needsAttach() ) { 123 if( ! needsAttach() ) {
124 m_deviceNr = 0; 124 m_deviceNr = 0;
125 emit isEnabled( 0, 1 ); 125 emit isEnabled( 0, 1 );
126 return TRUE; 126 return TRUE;
127 } 127 }
128 128
129 if( m_hciattachPid ) { 129 if( m_hciattachPid ) {
130 QString S; 130 QString S;
@@ -147,92 +147,92 @@ bool OTDevice::checkAttach(){
147 return m_hciattachPid != 0; 147 return m_hciattachPid != 0;
148} 148}
149 149
150void OTDevice::slotStdOut(OProcess* proc, char* , int ) { 150void OTDevice::slotStdOut(OProcess* proc, char* , int ) {
151 if( proc == m_hciattach ) { 151 if( proc == m_hciattach ) {
152 m_hciattach->detach(); 152 m_hciattach->detach();
153 153
154 // system enabled 154 // system enabled
155 // currently no way to figure out which attach produce which 155 // currently no way to figure out which attach produce which
156 // hci 156 // hci
157 if( m_deviceNr == -1 ) { 157 if( m_deviceNr == -1 ) {
158 m_deviceNr = 0; 158 m_deviceNr = 0;
159 emit isEnabled( m_deviceNr, 1 ); 159 emit isEnabled( m_deviceNr, 1 );
160 } 160 }
161 } 161 }
162} 162}
163 163
164void OTDevice::slotStdErr(OProcess* proc, char* chars, int len) { 164void OTDevice::slotStdErr(OProcess* proc, char* chars, int len) {
165 165
166 if(proc == m_hciattach && len >= 1 ){ 166 if(proc == m_hciattach && len >= 1 ){
167 // collect output 167 // collect output
168 QCString string( chars, len+1 ); // \0 == +1 168 QCString string( chars, len+1 ); // \0 == +1
169 QString m_output; 169 QString m_output;
170 m_output.append( string.data() ); 170 m_output.append( string.data() );
171 owarn << m_output << oendl; 171 odebug << m_output << oendl;
172 } 172 }
173} 173}
174 174
175pid_t OTDevice::getPidOfHCIAttach( void ) { 175pid_t OTDevice::getPidOfHCIAttach( void ) {
176 176
177 if( needsAttach() ) { 177 if( needsAttach() ) {
178 // not yet attached -> perhaps now ? 178 // not yet attached -> perhaps now ?
179 // load /proc dir and check if command name contains hciattach 179 // load /proc dir and check if command name contains hciattach
180 QRegExp R("[0-9]+"); 180 QRegExp R("[0-9]+");
181 QDir ProcDir( "/proc" ); 181 QDir ProcDir( "/proc" );
182 QFileInfo FI; 182 QFileInfo FI;
183 QStringList EL = ProcDir.entryList( QDir::Dirs ); 183 QStringList EL = ProcDir.entryList( QDir::Dirs );
184 184
185 // print it out 185 // print it out
186 for ( QStringList::Iterator it = EL.begin(); 186 for ( QStringList::Iterator it = EL.begin();
187 it != EL.end(); 187 it != EL.end();
188 ++it ) { 188 ++it ) {
189 if( R.match( (*it) ) >= 0 ) { 189 if( R.match( (*it) ) >= 0 ) {
190 // is pid 190 // is pid
191 191
192 // get command being executed 192 // get command being executed
193 FI.setFile( ProcDir.path()+"/"+ (*it) + "/exe" ); 193 FI.setFile( ProcDir.path()+"/"+ (*it) + "/exe" );
194 194
195 // get the link 195 // get the link
196 if( FI.readLink().right( 9 ) == "hciattach" ) { 196 if( FI.readLink().right( 9 ) == "hciattach" ) {
197 // this is hci attach process 197 // this is hci attach process
198 198
199 return (*it).toULong(); 199 return (*it).toULong();
200 break; 200 break;
201 } 201 }
202 } 202 }
203 } 203 }
204 } 204 }
205 205
206 return 0; 206 return 0;
207} 207}
208 208
209void OTDevice::detectDeviceType( QString & Device, 209void OTDevice::detectDeviceType( QString & Device,
210 QString & Mode, 210 QString & Mode,
211 unsigned long & Speed ) { 211 unsigned long & Speed ) {
212 212
213 // detect device type and determine parms 213 // detect device type and determine parms
214 owarn << "Detecting device" << oendl; 214 odebug << "Detecting device" << oendl;
215 switch ( ODevice::inst()->model() ) { 215 switch ( ODevice::inst()->model() ) {
216 case Model_iPAQ_H39xx: 216 case Model_iPAQ_H39xx:
217 Device = "/dev/tts/1"; 217 Device = "/dev/tts/1";
218 Mode = "bcsp"; 218 Mode = "bcsp";
219 Speed = 921600; 219 Speed = 921600;
220 NeedsAttach = 1; 220 NeedsAttach = 1;
221 break; 221 break;
222 222
223 case Model_iPAQ_H5xxx: 223 case Model_iPAQ_H5xxx:
224 Device = "/dev/tts/1"; 224 Device = "/dev/tts/1";
225 Mode = "any"; 225 Mode = "any";
226 Speed = 921600; 226 Speed = 921600;
227 NeedsAttach = 1; 227 NeedsAttach = 1;
228 break; 228 break;
229 229
230 case Model_GenuineIntel : 230 case Model_GenuineIntel :
231 Device = ""; 231 Device = "";
232 Mode = ""; 232 Mode = "";
233 Speed = 0; 233 Speed = 0;
234 NeedsAttach = 0; 234 NeedsAttach = 0;
235 break; 235 break;
236 236
237 default: 237 default:
238 Device = "/dev/ttySB0"; 238 Device = "/dev/ttySB0";