added command line option for gadgetfs mountpoint
git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@331 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -62,6 +62,7 @@ static const char *doserial = NULL;
|
|||||||
static const char *doiintf = NULL;
|
static const char *doiintf = NULL;
|
||||||
static int usb_reader_num = -1;
|
static int usb_reader_num = -1;
|
||||||
static const char *cdriver = NULL;
|
static const char *cdriver = NULL;
|
||||||
|
static const char *gadgetfs = "/dev/gadget";
|
||||||
|
|
||||||
#define OPT_HELP 'h'
|
#define OPT_HELP 'h'
|
||||||
#define OPT_INTERRUPT 'n'
|
#define OPT_INTERRUPT 'n'
|
||||||
@@ -73,6 +74,7 @@ static const char *cdriver = NULL;
|
|||||||
#define OPT_VERBOSE 'v'
|
#define OPT_VERBOSE 'v'
|
||||||
#define OPT_INFO 'o'
|
#define OPT_INFO 'o'
|
||||||
#define OPT_CARD 'c'
|
#define OPT_CARD 'c'
|
||||||
|
#define OPT_GADGETFS 'g'
|
||||||
|
|
||||||
static const struct option options[] = {
|
static const struct option options[] = {
|
||||||
/*{ "hid", no_argument, &dohid, 1 },*/
|
/*{ "hid", no_argument, &dohid, 1 },*/
|
||||||
@@ -86,6 +88,7 @@ static const struct option options[] = {
|
|||||||
{ "interrupt", no_argument, NULL, OPT_INTERRUPT },
|
{ "interrupt", no_argument, NULL, OPT_INTERRUPT },
|
||||||
{ "verbose", no_argument, NULL, OPT_VERBOSE },
|
{ "verbose", no_argument, NULL, OPT_VERBOSE },
|
||||||
{ "info", no_argument, NULL, OPT_INFO },
|
{ "info", no_argument, NULL, OPT_INFO },
|
||||||
|
{ "gadgetfs", required_argument, NULL, OPT_GADGETFS },
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
static const char *option_help[] = {
|
static const char *option_help[] = {
|
||||||
@@ -99,7 +102,8 @@ static const char *option_help[] = {
|
|||||||
"USB vendor ID (default: 0x0D46)",
|
"USB vendor ID (default: 0x0D46)",
|
||||||
"Add interrupt pipe for CCID",
|
"Add interrupt pipe for CCID",
|
||||||
"Use (several times) to be more verbose",
|
"Use (several times) to be more verbose",
|
||||||
"Print version, available readers and drivers.",
|
"Print version, available readers and drivers",
|
||||||
|
"Directory where GadgetFS is mounted",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* NOTE: these IDs don't imply endpoint numbering; host side drivers
|
/* NOTE: these IDs don't imply endpoint numbering; host side drivers
|
||||||
@@ -1311,8 +1315,8 @@ static int init_device (void)
|
|||||||
#endif
|
#endif
|
||||||
result = autoconfig ();
|
result = autoconfig ();
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
fprintf (stderr, "?? don't recognize /dev/gadget %s device\n",
|
fprintf (stderr, "?? don't recognize %s %s device\n",
|
||||||
iso ? "iso" : "bulk");
|
gadgetfs, iso ? "iso" : "bulk");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1727,7 +1731,7 @@ main (int argc, char **argv)
|
|||||||
int oindex = 0;
|
int oindex = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
c = getopt_long(argc, argv, "hnr:s:i:p:e:voc:", options, &oindex);
|
c = getopt_long(argc, argv, "hnr:s:i:p:e:voc:g:", options, &oindex);
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
break;
|
break;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@@ -1777,6 +1781,9 @@ main (int argc, char **argv)
|
|||||||
case OPT_INTERRUPT:
|
case OPT_INTERRUPT:
|
||||||
doint++;
|
doint++;
|
||||||
break;
|
break;
|
||||||
|
case OPT_GADGETFS:
|
||||||
|
gadgetfs = optarg;
|
||||||
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
/* fall through */
|
/* fall through */
|
||||||
default:
|
default:
|
||||||
@@ -1809,8 +1816,8 @@ main (int argc, char **argv)
|
|||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf (stderr, "serial=\"%s\"\n", serial);
|
fprintf (stderr, "serial=\"%s\"\n", serial);
|
||||||
|
|
||||||
if (chdir ("/dev/gadget") < 0) {
|
if (chdir (gadgetfs) < 0) {
|
||||||
perror ("can't chdir /dev/gadget");
|
fprintf (stderr, "Error changing directory to %s\n", gadgetfs);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1844,7 +1851,7 @@ main (int argc, char **argv)
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return 1;
|
return 1;
|
||||||
if (debug)
|
if (debug)
|
||||||
fprintf (stderr, "/dev/gadget/%s ep0 configured\n", DEVNAME);
|
fprintf (stderr, "%s%s ep0 configured\n", gadgetfs, DEVNAME);
|
||||||
|
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
fflush (stderr);
|
fflush (stderr);
|
||||||
|
|||||||
Reference in New Issue
Block a user