add some error checks in adb_reinit, enabled with ADB_DEBUG and adb_debug

This commit is contained in:
dbj 2002-01-02 20:30:45 +00:00
parent 32eabd8148
commit 920e8af571
1 changed files with 15 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: adb_direct.c,v 1.19 2001/08/03 23:09:42 tsubai Exp $ */ /* $NetBSD: adb_direct.c,v 1.20 2002/01/02 20:30:45 dbj Exp $ */
/* From: adb_direct.c 2.02 4/18/97 jpw */ /* From: adb_direct.c 2.02 4/18/97 jpw */
@ -1258,9 +1258,15 @@ adb_reinit(void)
delay(1000); delay(1000);
/* send an ADB reset first */ /* send an ADB reset first */
adb_op_sync((Ptr)0, (Ptr)0, (Ptr)0, (short)0x00); result = adb_op_sync((Ptr)0, (Ptr)0, (Ptr)0, (short)0x00);
delay(200000); delay(200000);
#ifdef ADB_DEBUG
if (result && adb_debug) {
printf_intr("adb_reinit: failed to reset, result = %d\n",result);
}
#endif
/* /*
* Probe for ADB devices. Probe devices 1-15 quickly to determine * Probe for ADB devices. Probe devices 1-15 quickly to determine
* which device addresses are in use and which are free. For each * which device addresses are in use and which are free. For each
@ -1285,6 +1291,13 @@ adb_reinit(void)
result = adb_op_sync((Ptr)send_string, (Ptr)0, result = adb_op_sync((Ptr)send_string, (Ptr)0,
(Ptr)0, (short)command); (Ptr)0, (short)command);
#ifdef ADB_DEBUG
if (result && adb_debug) {
printf_intr("adb_reinit: scan of device %d, result = %d, str = 0x%x\n",
i,result,send_string[0]);
}
#endif
if (send_string[0] != 0) { if (send_string[0] != 0) {
/* check for valid device handler */ /* check for valid device handler */
switch (send_string[2]) { switch (send_string[2]) {