-rw-r--r-- | noncore/securityplugins/blueping/bluepingplugin.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/noncore/securityplugins/blueping/bluepingplugin.cpp b/noncore/securityplugins/blueping/bluepingplugin.cpp index 1c514e5..05c26ba 100644 --- a/noncore/securityplugins/blueping/bluepingplugin.cpp +++ b/noncore/securityplugins/blueping/bluepingplugin.cpp | |||
@@ -150,64 +150,68 @@ int BluepingPlugin::authenticate() { | |||
150 | layout->addWidget(&pbSkip, 0, Qt::AlignHCenter); | 150 | layout->addWidget(&pbSkip, 0, Qt::AlignHCenter); |
151 | 151 | ||
152 | // connect the skip button to the skip signal emitting function | 152 | // connect the skip button to the skip signal emitting function |
153 | QObject::connect(&pbSkip, SIGNAL(clicked()), this, SLOT(skip())); | 153 | QObject::connect(&pbSkip, SIGNAL(clicked()), this, SLOT(skip())); |
154 | // connect the signal emitting functions to the bluepingDialog done(int) finishing function | 154 | // connect the signal emitting functions to the bluepingDialog done(int) finishing function |
155 | QObject::connect(this, SIGNAL(emitCode(int)), &bluepingDialog, SLOT(done(int))); | 155 | QObject::connect(this, SIGNAL(emitCode(int)), &bluepingDialog, SLOT(done(int))); |
156 | 156 | ||
157 | 157 | ||
158 | 158 | ||
159 | /* let's start Bluetooth if it's not running | 159 | /* let's start Bluetooth if it's not running |
160 | */ | 160 | */ |
161 | OProcess checkB; | 161 | OProcess checkB; |
162 | checkB << "pidof" << "hciattach"; | 162 | checkB << "pidof" << "hciattach"; |
163 | odebug << "checking if Bluetooth is running..." << oendl; | 163 | odebug << "checking if Bluetooth is running..." << oendl; |
164 | // now we start bluetooth *only* if the previous command works, exits normally, and | 164 | // now we start bluetooth *only* if the previous command works, exits normally, and |
165 | // it returns a non-null exit code (which means hciattach is not running) | 165 | // it returns a non-null exit code (which means hciattach is not running) |
166 | if ( checkB.start(OProcess::Block) && checkB.normalExit() && (checkB.exitStatus() != 0) ) | 166 | if ( checkB.start(OProcess::Block) && checkB.normalExit() && (checkB.exitStatus() != 0) ) |
167 | { | 167 | { |
168 | // remember to switch off Bluetooth once we're finished... | 168 | // remember to switch off Bluetooth once we're finished... |
169 | bluetoothWasOff = true; | 169 | bluetoothWasOff = true; |
170 | odebug << "Bluetooth is not running, we must start it now" << oendl; | 170 | odebug << "Bluetooth is not running, we must start it now" << oendl; |
171 | 171 | ||
172 | OProcess startB; | 172 | OProcess startB; |
173 | switch ( ODevice::inst()->model() ) { | 173 | switch ( ODevice::inst()->model() ) { |
174 | case Model_iPAQ_H39xx: | 174 | case Model_iPAQ_H39xx: |
175 | startB << "/sbin/hciattach" << "/dev/tts/1" << "bcsp" << "921600"; | 175 | startB << "/sbin/hciattach" << "/dev/tts/1" << "bcsp" << "921600"; |
176 | break; | 176 | break; |
177 | 177 | ||
178 | case Model_iPAQ_H5xxx: | 178 | case Model_iPAQ_H5xxx: |
179 | startB << "/sbin/hciattach" << "/dev/tts/1" << "any" << "921600"; | 179 | startB << "/sbin/hciattach" << "/dev/tts/1" << "any" << "921600"; |
180 | break; | 180 | break; |
181 | 181 | ||
182 | case Model_MyPal_716: | ||
183 | startB << "/sbin/hciattach" << "/dev/ttyS1" << "bcsp" << "921600"; | ||
184 | break; | ||
185 | |||
182 | default: | 186 | default: |
183 | startB << "/sbin/hciattach" << "/dev/ttySB0" << "bcsp" << "230400"; | 187 | startB << "/sbin/hciattach" << "/dev/ttySB0" << "bcsp" << "230400"; |
184 | break; | 188 | break; |
185 | } // end switch on device models | 189 | } // end switch on device models |
186 | 190 | ||
187 | if ( !startB.start(OProcess::Block) ) { | 191 | if ( !startB.start(OProcess::Block) ) { |
188 | oerr << "could not start Bluetooth" << oendl; | 192 | oerr << "could not start Bluetooth" << oendl; |
189 | return MultiauthPluginObject::Skip; | 193 | return MultiauthPluginObject::Skip; |
190 | } | 194 | } |
191 | else | 195 | else |
192 | { | 196 | { |
193 | if ( (startB.normalExit()) && (startB.exitStatus() == 0) ) | 197 | if ( (startB.normalExit()) && (startB.exitStatus() == 0) ) |
194 | { | 198 | { |
195 | odebug << "hciattach exited normally, Bluetooth is probably on now, let's wait 500 ms and ping" << oendl; | 199 | odebug << "hciattach exited normally, Bluetooth is probably on now, let's wait 500 ms and ping" << oendl; |
196 | // 500 ms timer, so l2ping won't try to find a route before bluetooth has \em really started | 200 | // 500 ms timer, so l2ping won't try to find a route before bluetooth has \em really started |
197 | QTimer::singleShot( 500, this, SLOT(ping()) ); | 201 | QTimer::singleShot( 500, this, SLOT(ping()) ); |
198 | } | 202 | } |
199 | else | 203 | else |
200 | { | 204 | { |
201 | owarn << "hciattach exited anormally (normalExit: " << startB.normalExit() << ", exit status: " << startB.exitStatus() << ")" << oendl; | 205 | owarn << "hciattach exited anormally (normalExit: " << startB.normalExit() << ", exit status: " << startB.exitStatus() << ")" << oendl; |
202 | return MultiauthPluginObject::Skip; | 206 | return MultiauthPluginObject::Skip; |
203 | } // end if startB exited normaly | 207 | } // end if startB exited normaly |
204 | } // end if startBluetooth started | 208 | } // end if startBluetooth started |
205 | } | 209 | } |
206 | else | 210 | else |
207 | { | 211 | { |
208 | // we don't need to wait, since bluetooth has been started long enough ago | 212 | // we don't need to wait, since bluetooth has been started long enough ago |
209 | odebug << "Bluetooth is already running, we can try to ping now" << oendl; | 213 | odebug << "Bluetooth is already running, we can try to ping now" << oendl; |
210 | ping(); | 214 | ping(); |
211 | } // end if Bluetooth was off | 215 | } // end if Bluetooth was off |
212 | 216 | ||
213 | 217 | ||