Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 libwacom/libwacom.c |   27 +++++++++++++++++++++++++++
 libwacom/libwacom.h |    7 +++++++
 2 files changed, 34 insertions(+)

diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
index c16c104..686a23e 100644
--- a/libwacom/libwacom.c
+++ b/libwacom/libwacom.c
@@ -740,6 +740,33 @@ WacomStylusType libwacom_stylus_get_type (const 
WacomStylus *stylus)
        return stylus->type;
 }
 
+void
+libwacom_print_stylus_description (FILE *file, const WacomStylus *stylus)
+{
+       const char *type;
+
+       fprintf(file, "[%#x]\n",        libwacom_stylus_get_id(stylus));
+       fprintf(file, "Name=%s\n",      libwacom_stylus_get_name(stylus));
+       fprintf(file, "Buttons=%d\n",   
libwacom_stylus_get_num_buttons(stylus));
+       fprintf(file, "HasEraser=%s\n", libwacom_stylus_has_eraser(stylus) ? 
"true" : "false");
+       fprintf(file, "IsEraser=%s\n",  libwacom_stylus_is_eraser(stylus) ? 
"true" : "false");
+       fprintf(file, "HasLens=%s\n",   libwacom_stylus_has_lens(stylus) ? 
"true" : "false");
+
+       switch(libwacom_stylus_get_type(stylus)) {
+               case WSTYLUS_UNKNOWN:   type = "Unknown";        break;
+               case WSTYLUS_GENERAL:   type = "General";        break;
+               case WSTYLUS_INKING:    type = "Inking";         break;
+               case WSTYLUS_AIRBRUSH:  type = "Airbrush";       break;
+               case WSTYLUS_CLASSIC:   type = "Classic";        break;
+               case WSTYLUS_MARKER:    type = "Marker";         break;
+               case WSTYLUS_STROKE:    type = "Stroke";         break;
+               case WSTYLUS_PUCK:      type = "Puck";          break;
+               default: BUG_WARN(libwacom_stylus_get_type(stylus)); break;
+       }
+
+       fprintf(file, "Type=%s\n", type);
+}
+
 void libwacom_stylus_destroy(WacomStylus *stylus)
 {
        g_free (stylus->name);
diff --git a/libwacom/libwacom.h b/libwacom/libwacom.h
index b3a30ef..806510a 100644
--- a/libwacom/libwacom.h
+++ b/libwacom/libwacom.h
@@ -507,6 +507,13 @@ int         libwacom_stylus_has_lens (const WacomStylus 
*stylus);
  */
 WacomStylusType libwacom_stylus_get_type (const WacomStylus *stylus);
 
+/**
+ * Print the description of this stylus to the given file.
+ *
+ * @param file The stream to print to
+ * @param stylus The stylus to print the description for.
+ */
+void libwacom_print_stylus_description (FILE *file, const WacomStylus *stylus);
 
 WacomBusType libwacom_match_get_bustype(const WacomMatch *match);
 uint32_t libwacom_match_get_product_id(const WacomMatch *match);
-- 
1.7.10


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to