testlibraw: Fix printing of card name
Testlibraw always showed the name of the first card rather than the name of the current card. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
This commit is contained in:
parent
d50f7381b2
commit
a24ab81d57
|
@ -226,11 +226,15 @@ read_cycle_timer(raw1394handle_t handle)
|
||||||
int test_card(int card)
|
int test_card(int card)
|
||||||
{
|
{
|
||||||
raw1394handle_t handle;
|
raw1394handle_t handle;
|
||||||
struct raw1394_portinfo pinf;
|
struct raw1394_portinfo *portinfo;
|
||||||
tag_handler_t std_handler;
|
tag_handler_t std_handler;
|
||||||
struct pollfd pfd;
|
struct pollfd pfd;
|
||||||
int i, l, n, numcards, retval, s;
|
int i, l, n, numcards, retval, s;
|
||||||
|
|
||||||
|
portinfo = malloc(sizeof(*portinfo) * (card + 1));
|
||||||
|
if (!portinfo)
|
||||||
|
return -1;
|
||||||
|
|
||||||
handle = raw1394_new_handle();
|
handle = raw1394_new_handle();
|
||||||
|
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
|
@ -240,6 +244,7 @@ int test_card(int card)
|
||||||
perror("couldn't get handle");
|
perror("couldn't get handle");
|
||||||
printf(not_loaded);
|
printf(not_loaded);
|
||||||
}
|
}
|
||||||
|
free(portinfo);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +254,7 @@ int test_card(int card)
|
||||||
raw1394_get_generation(handle));
|
raw1394_get_generation(handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
numcards = raw1394_get_port_info(handle, &pinf, 1);
|
numcards = raw1394_get_port_info(handle, portinfo, card + 1);
|
||||||
if (numcards < card)
|
if (numcards < card)
|
||||||
perror("couldn't get card info");
|
perror("couldn't get card info");
|
||||||
else if (card == 0)
|
else if (card == 0)
|
||||||
|
@ -259,7 +264,7 @@ int test_card(int card)
|
||||||
if (numcards <= card)
|
if (numcards <= card)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
printf("\ncard %d, name: %s\n", card, pinf.name);
|
printf("\ncard %d, name: %s\n", card, portinfo[card].name);
|
||||||
|
|
||||||
if (raw1394_set_port(handle, card) < 0) {
|
if (raw1394_set_port(handle, card) < 0) {
|
||||||
perror("couldn't set port");
|
perror("couldn't set port");
|
||||||
|
@ -344,6 +349,7 @@ int test_card(int card)
|
||||||
perror("poll failed");
|
perror("poll failed");
|
||||||
out:
|
out:
|
||||||
raw1394_destroy_handle(handle);
|
raw1394_destroy_handle(handle);
|
||||||
|
free(portinfo);
|
||||||
return numcards;
|
return numcards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue