|
37 | 37 | import android.content.IntentFilter; |
38 | 38 | import android.os.Build; |
39 | 39 | import android.os.ParcelFileDescriptor; |
40 | | -import android.util.Log; |
41 | 40 |
|
42 | 41 | import net.sourceforge.smallbasic.ioio.IOIOLoader; |
43 | 42 |
|
|
56 | 55 | import ioio.lib.impl.FixedReadBufferedInputStream; |
57 | 56 | import ioio.lib.spi.IOIOConnectionBootstrap; |
58 | 57 | import ioio.lib.spi.IOIOConnectionFactory; |
| 58 | +import ioio.lib.spi.Log; |
59 | 59 | import ioio.lib.spi.NoRuntimeSupportException; |
60 | 60 |
|
61 | 61 | public class AccessoryConnectionBootstrap extends BroadcastReceiver implements IOIOConnectionBootstrap, IOIOConnectionFactory { |
@@ -191,8 +191,7 @@ private boolean tryOpen() { |
191 | 191 | if (!usbManager.hasPermission(accessory)) { |
192 | 192 | if (pendingIntent == null) { |
193 | 193 | Log.v(TAG, "Requesting permission."); |
194 | | - pendingIntent = PendingIntent.getBroadcast(activity, 0, new Intent( |
195 | | - ACTION_USB_PERMISSION), 0); |
| 194 | + pendingIntent = PendingIntent.getBroadcast(activity, 0, new Intent(ACTION_USB_PERMISSION), 0); |
196 | 195 | usbManager.requestPermission(accessory, pendingIntent); |
197 | 196 | } |
198 | 197 | return false; |
@@ -228,7 +227,7 @@ private boolean tryOpen() { |
228 | 227 | // bug: |
229 | 228 | // http://code.google.com/p/android/issues/detail?id=20545 |
230 | 229 | while (inputStream.read() != 1) { |
231 | | - trySleep(1000); |
| 230 | + trySleep(); |
232 | 231 | } |
233 | 232 |
|
234 | 233 | success = true; |
@@ -262,10 +261,10 @@ private void registerReceiver() { |
262 | 261 | } |
263 | 262 | } |
264 | 263 |
|
265 | | - private void trySleep(long time) { |
| 264 | + private void trySleep() { |
266 | 265 | synchronized (AccessoryConnectionBootstrap.this) { |
267 | 266 | try { |
268 | | - AccessoryConnectionBootstrap.this.wait(time); |
| 267 | + AccessoryConnectionBootstrap.this.wait(1000); |
269 | 268 | } catch (InterruptedException e) { |
270 | 269 | Log.e(TAG, e.toString()); |
271 | 270 | } |
|
0 commit comments