From 09252ec22d58e946494e4ca2cf367bf3bbe1cc50 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 21 Aug 2010 17:09:41 -0700 Subject: altos: Define USB product ID in per-product Makefile.defs file This allows Win7 to tell which kind of device is connected purely by USB id as it doesn't expose the USB product ID string to user space. Signed-off-by: Keith Packard --- src/ao-make-product.5c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/ao-make-product.5c') diff --git a/src/ao-make-product.5c b/src/ao-make-product.5c index 933032dd..5f2eb8e8 100644 --- a/src/ao-make-product.5c +++ b/src/ao-make-product.5c @@ -37,11 +37,19 @@ write_int(int a, string description) printf ("#define AO_%s_NUMBER %d\n\n", description, a); } +void +write_hex(int a, string description) +{ + printf ("/* %s */\n", description); + printf ("#define AO_%s_NUMBER 0x%04x\n\n", description, a); +} + string manufacturer = "altusmetrum.org"; string product = "TeleMetrum"; string version = "0.0"; int serial = 1; int user_argind = 0; +int id_product = 0x000a; argdesc argd = { .args = { @@ -57,6 +65,12 @@ argdesc argd = { .name = "product", .expr_name = "prod", .desc = "Product name." }, + { + .var = { .arg_int = &id_product }, + .abbr = 'i', + .name = "id_product", + .expr_name = "id_p", + .desc = "Product ID." }, { .var = { .arg_int = &serial }, .abbr = 's', @@ -82,6 +96,7 @@ main() write_ucs2(product, "iProduct"); write_ucs2(sprintf("%06d", serial), "iSerial"); write_int(serial, "iSerial"); + write_hex(id_product, "idProduct"); write_string(version, "iVersion"); } -- cgit v1.2.3