summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrwastl <mrwastl@users.sourceforge.net>2011-09-23 20:04:59 +0200
committermrwastl <mrwastl@users.sourceforge.net>2011-09-23 20:04:59 +0200
commitd82aaf34feead02bab70b12c7c8c2effb1187862 (patch)
tree799ee0756bd0b69e6c2696389b6f1f8e27a1a20c
parent72fa990816f5feadb561f75b78dd4324153dc8c0 (diff)
downloadgraphlcd-base-d82aaf34feead02bab70b12c7c8c2effb1187862.tar.gz
graphlcd-base-d82aaf34feead02bab70b12c7c8c2effb1187862.tar.bz2
patches for thread-safeness of AX206DPF driver (contrib by superelchi)
-rw-r--r--docs/DRIVER.ax206dpf17
-rw-r--r--glcddrivers/ax206dpf.c20
-rw-r--r--glcddrivers/ax206dpf.h27
3 files changed, 36 insertions, 28 deletions
diff --git a/docs/DRIVER.ax206dpf b/docs/DRIVER.ax206dpf
index d8faf4b..268c74d 100644
--- a/docs/DRIVER.ax206dpf
+++ b/docs/DRIVER.ax206dpf
@@ -37,14 +37,15 @@ continue until all needed displays are detected.
Non-root users
--------------
-The driver needs write access to /dev/proc/usb. So the calling user
-must be root or you have to modify the access rights for /dev/proc/usb.
-For Debian/Ubuntu this can be done with a custom udev rule like:
-SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664", GROUP="<user_group>"
-Replace <user_group> with a group the calling user belongs to.
-Put this rule in a new file "nn-usbuser.rules" in /etc/udev/rules.d.
-Replace "nn" by two digits that are lower than any existing usb rule.
-For my Ubuntu 10.04 system I used "/etc/udev/rules.d/35-usbuser.rules".
+The driver needs write access to the USB port of the display module.
+If the enclosed udev-rules file '99-graphlcd-base.rules' is installed, add
+the user(s) that should be authorised to use the display to the group 'uucp'.
+
+If the enclosed udev-rule will not be used a custom rule needs to be provided if
+other users than root are to be authorised:
+
+ATTRS{idVendor}=="1908", ATTRS{idProduct}=="0102", GROUP="<user_group>", MODE="0660"
+Replace <user_group> through a unix group of your desire.
Configuration Parameters
diff --git a/glcddrivers/ax206dpf.c b/glcddrivers/ax206dpf.c
index 9ff2c39..7c9935a 100644
--- a/glcddrivers/ax206dpf.c
+++ b/glcddrivers/ax206dpf.c
@@ -29,9 +29,10 @@
* HISTORY
*
* v0.1 - 10 Aug 2011 - Inital release
- * V0.2 - 20 Aug 2011 - Optimized display data transfer
+ * v0.2 - 20 Aug 2011 - Optimized display data transfer
* SetBrightness() implemented
* Multi-display support
+ * v0.3 - 02 Sep 2011 - Fixed multi-thread problem
*
*
*/
@@ -52,23 +53,8 @@
namespace GLCD
{
-typedef struct display_handle {
- bool attached;
- char address[8];
- bool isPortrait;
- bool rotate90;
- bool flip;
- int minx, maxx;
- int miny, maxy;
- LIBDPF::DPFContext *dpfh;
- unsigned char * LCD;
-} DISPLAYHANDLE;
-
-static DISPLAYHANDLE *dh[MAX_DPFS];
+
static pthread_mutex_t libax_mutex;
-static std::string flips = "";
-static time_t lastscan;
-static int lastbrightness;
cDriverAX206DPF::cDriverAX206DPF(cDriverConfig * config)
diff --git a/glcddrivers/ax206dpf.h b/glcddrivers/ax206dpf.h
index cc5e608..d683ccf 100644
--- a/glcddrivers/ax206dpf.h
+++ b/glcddrivers/ax206dpf.h
@@ -25,9 +25,6 @@
*
* (c) 2011 Lutz Neumann <superelchi AT wolke7.net>
*
- * HISTORY
- *
- * v0.1 - 10 Aug 2011 - Inital release
*/
#ifndef _GLCDDRIVERS_AX206DPF_H_
@@ -35,6 +32,11 @@
#include "driver.h"
+namespace LIBDPF {
+struct dpf_context;
+typedef dpf_context DPFContext;
+}
+
namespace GLCD
{
#define MAX_DPFS 4
@@ -45,6 +47,19 @@ namespace GLCD
#define USB_SCAN_INTERVALL 10 // seconds between usb scans for missing displays
+typedef struct display_handle {
+ bool attached;
+ char address[8];
+ bool isPortrait;
+ bool rotate90;
+ bool flip;
+ int minx, maxx;
+ int miny, maxy;
+ LIBDPF::DPFContext *dpfh;
+ unsigned char * LCD;
+} DISPLAYHANDLE;
+
+
class cDriverConfig;
class cDriverAX206DPF : public cDriver
@@ -61,6 +76,12 @@ private:
unsigned int sizey; // logical vertical size of one display
unsigned int bpp; // bits per pixel
+ DISPLAYHANDLE *dh[MAX_DPFS];
+ std::string flips;
+ time_t lastscan;
+ int lastbrightness;
+
+
int CheckSetup();
void ResetMinMax();
bool RescanUSB();