Extend win32 test to check get_arg("mmc-supported?"). Turn ASPI load failer into an info message

This commit is contained in:
R. Bernstein
2010-01-18 03:30:40 -05:00
parent 3bdc6820e5
commit fa897e85b9
3 changed files with 35 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/* /*
Copyright (C) 2004, 2005, 2008, 2009 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2004, 2005, 2008, 2009, 2010 Rocky Bernstein <rocky@gnu.org>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -155,7 +155,7 @@ have_aspi( HMODULE *hASPI,
*hASPI = LoadLibrary( "wnaspi32.dll" ); *hASPI = LoadLibrary( "wnaspi32.dll" );
if( *hASPI == NULL ) { if( *hASPI == NULL ) {
cdio_debug("Unable to load ASPI DLL"); cdio_warn("Unable to load ASPI DLL");
return false; return false;
} }

View File

@@ -1,7 +1,6 @@
/* /*
$Id: win32.c,v 1.37 2008/04/21 18:30:21 karl Exp $ Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010
Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2003, 2004, 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -646,6 +645,23 @@ eject_media_win32 (void *p_user_data)
return open_close_media_win32(psz_drive, MCI_SET_DOOR_OPEN); return open_close_media_win32(psz_drive, MCI_SET_DOOR_OPEN);
} }
static bool
is_mmc_supported(void *user_data)
{
_img_private_t *env = user_data;
switch (env->access_mode) {
case _AM_NONE:
return false;
case _AM_IOCTL:
case _AM_ASPI:
case _AM_MMC_RDWR:
case _AM_MMC_RDWR_EXCL:
return true;
}
/* Not reached. */
return false;
}
/*! /*!
Return the value associated with the key "arg". Return the value associated with the key "arg".
*/ */
@@ -669,6 +685,8 @@ get_arg_win32 (void *p_user_data, const char key[])
case _AM_NONE: case _AM_NONE:
return "no access method"; return "no access method";
} }
} else if (!strcmp (key, "mmc-supported?")) {
return is_mmc_supported(p_user_data) ? "true" : "false";
} }
return NULL; return NULL;
} }

View File

@@ -1,5 +1,5 @@
/* -*- C -*- /* -*- C -*-
Copyright (C) 2009 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2009, 2010 Rocky Bernstein <rocky@gnu.org>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -81,13 +81,23 @@ main(int argc, const char *argv[])
p_cdio = cdio_open_am_win32(ppsz_drives[0], "ioctl"); p_cdio = cdio_open_am_win32(ppsz_drives[0], "ioctl");
if (p_cdio) { if (p_cdio) {
const char *psz_access_mode = cdio_get_arg(p_cdio, "access-mode"); const char *psz_access_mode = cdio_get_arg(p_cdio, "access-mode");
const char *psz_response = cdio_get_arg(p_cdio, "mmc-supported?");
if (0 != strncmp(psz_access_mode, "ioctl", strlen("ioctl"))) { if (0 != strncmp(psz_access_mode, "ioctl", strlen("ioctl"))) {
fprintf(stderr, fprintf(stderr,
"Got %s; Should get back %s, the access mode requested.\n", "Got %s; Should get back %s, the access mode requested.\n",
psz_access_mode, "ioctl"); psz_access_mode, "ioctl");
exit(2); exit(3);
} }
if ( psz_response == NULL ||
((0 != strncmp("true", psz_response, sizeof("true")))) ) {
fprintf(stderr,
"cdio_get_arg(\"mmc-supported?\") should return \"true\"; got: %s.\n",
psz_response);
exit(4);
}
} }
cdio_destroy(p_cdio); cdio_destroy(p_cdio);