r2773 - in vdr/vdr-plugin-serial/trunk/debian: . patches

Tobias Grimm tiber-guest at costa.debian.org
Fri May 12 18:48:28 UTC 2006


Author: tiber-guest
Date: 2006-05-12 18:48:09 +0000 (Fri, 12 May 2006)
New Revision: 2773

Added:
   vdr/vdr-plugin-serial/trunk/debian/patches/02_0.0.6c.dpatch
Modified:
   vdr/vdr-plugin-serial/trunk/debian/changelog
   vdr/vdr-plugin-serial/trunk/debian/patches/00list
Log:
Added 02_0.0.6c.dpatch


Modified: vdr/vdr-plugin-serial/trunk/debian/changelog
===================================================================
--- vdr/vdr-plugin-serial/trunk/debian/changelog	2006-05-11 20:12:19 UTC (rev 2772)
+++ vdr/vdr-plugin-serial/trunk/debian/changelog	2006-05-12 18:48:09 UTC (rev 2773)
@@ -1,3 +1,10 @@
+vdr-plugin-serial (0.0.6a-2) unstable; urgency=low
+
+  * Tobias Grimm <tg at e-tobi.net>
+    - Added 02_0.0.6c.dpatch
+
+ -- Debian VDR Team <pkg-vdr-dvb-devel at lists.alioth.debian.org>  Fri, 12 May 2006 20:47:37 +0200
+
 vdr-plugin-serial (0.0.6a-1) unstable; urgency=low
 
   * Initial Release.

Modified: vdr/vdr-plugin-serial/trunk/debian/patches/00list
===================================================================
--- vdr/vdr-plugin-serial/trunk/debian/patches/00list	2006-05-11 20:12:19 UTC (rev 2772)
+++ vdr/vdr-plugin-serial/trunk/debian/patches/00list	2006-05-12 18:48:09 UTC (rev 2773)
@@ -1,3 +1,4 @@
 01_Makefile-fPIC-fix
+02_0.0.6c
 
 90_APIVERSION.dpatch

Added: vdr/vdr-plugin-serial/trunk/debian/patches/02_0.0.6c.dpatch
===================================================================
--- vdr/vdr-plugin-serial/trunk/debian/patches/02_0.0.6c.dpatch	2006-05-11 20:12:19 UTC (rev 2772)
+++ vdr/vdr-plugin-serial/trunk/debian/patches/02_0.0.6c.dpatch	2006-05-12 18:48:09 UTC (rev 2773)
@@ -0,0 +1,428 @@
+#!/bin/sh /usr/share/dpatch/dpatch-run
+
+## 01_0.0.6c.dpatch
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Upgrades to inofficial version 0.0.6c.
+
+ at DPATCH@
+diff -Nur serial-0.0.6a/serial.c serial-0.0.6c/serial.c
+--- serial-0.0.6a/serial.c	2005-07-22 12:48:36.000000000 +0200
++++ serial-0.0.6c/serial.c	2006-05-12 20:28:13.000000000 +0200
+@@ -27,8 +27,9 @@
+ #define LEDREC TIOCM_RTS
+ #define LED2 TIOCM_SR
+ #define MAXCYCLE 10
++#define MAXDELAY 7
+ 
+-static const char *VERSION        = "0.0.6a";
++static const char *VERSION        = "0.0.6c";
+ static const char *DESCRIPTION    = "Frontpanel plugin for the serial line";
+ //static const char *MAINMENUENTRY  = NULL;
+ 
+@@ -38,6 +39,7 @@
+ struct sSerialSetup {
+   int iFlash;
+   int Port;
++  int kpDelay;
+ };
+ 
+ sSerialSetup SerialSetup;
+@@ -51,115 +53,105 @@
+   cMenuSetupSerial(void);
+ };
+ 
+-cMenuSetupSerial::cMenuSetupSerial(void)
+-{
++cMenuSetupSerial::cMenuSetupSerial(void) {
+   newSerialSetup.iFlash = SerialSetup.iFlash;
+   newSerialSetup.Port = SerialSetup.Port;
+-  Add(new cMenuEditIntItem( tr("Flashrate"), &newSerialSetup.iFlash, 1, 10));
++  newSerialSetup.kpDelay = SerialSetup.kpDelay;
++  Add(new cMenuEditIntItem( tr("Flashrate"), &newSerialSetup.iFlash, 1, MAXCYCLE));
+   Add(new cMenuEditIntItem( tr("Serial Port (COM)"), &newSerialSetup.Port, 1, 4));
++  Add(new cMenuEditIntItem( tr("Key press delay"), &newSerialSetup.kpDelay, 0, MAXDELAY));
+ }
+ 
+-void cMenuSetupSerial::Store(void)
+-{
++void cMenuSetupSerial::Store(void) {
+   SetupStore("Flashrate", SerialSetup.iFlash = newSerialSetup.iFlash);
+   SetupStore("Port", SerialSetup.Port = newSerialSetup.Port);
++  SetupStore("KeyPressDelay", SerialSetup.kpDelay = newSerialSetup.kpDelay);
+ }
+ 
+-class cSerialStatus : public cStatus
+-{
++class cSerialStatus : public cStatus {
+ private:
+-  int iLedStatus[MAXCYCLE];
++  int iLedStatus[MAXCYCLE-1];
+   int iNumDevices;
+ 
+ protected:
++#if VDRVERSNUM < 10338
+   virtual void Recording(const cDevice *Device, const char *Name);
++#else
++  virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On);
++#endif
+ 
+ public:
+   int GetLedStatus(int i);
+   cSerialStatus(void);
+-  int iCardIsRecording[MAXDEVICES];
++  int iCardIsRecording[MAXDEVICES-1];
+ };
+ 
+-cSerialStatus::cSerialStatus(void)
+-{
+-	for(int i=0; i<MAXCYCLE; i++)
+-		iLedStatus[i] = 0;
+-	for(int i=0; i<MAXDEVICES; i++)
+-		iCardIsRecording[i] = 0;
+-	iNumDevices = 0;
++cSerialStatus::cSerialStatus(void) {
++  for(int i=0; i<MAXCYCLE; i++)    iLedStatus[i] = 0;
++  for(int i=0; i<MAXDEVICES; i++)  iCardIsRecording[i] = 0;
++  iNumDevices = cDevice::NumDevices();
++  dsyslog("SERIAL: iNumDevices=%d", iNumDevices);
+ }
+ 
+-int cSerialStatus::GetLedStatus(int j)
+-{
++int cSerialStatus::GetLedStatus(int j) {
+   int iOccupiedDevices = 0;
+   int i;
+ 
+-  for(i=0; i<iNumDevices; i++) 
+-    if(iCardIsRecording[i])
+-		iOccupiedDevices++;
+-  
+-  if((iNumDevices == iOccupiedDevices) && (iOccupiedDevices >0)) // Blinken
+-  {
+-    for(i=0; i<SerialSetup.iFlash; i++)
+-		iLedStatus[i] |=  LEDREC; // Bit setzen
+-    for(i=SerialSetup.iFlash; i<MAXCYCLE; i++)
+-		iLedStatus[i] &= ~LEDREC; // Bit loeschen
++  for(i=0;i<iNumDevices;i++) {
++    if (iCardIsRecording[i]>0) iOccupiedDevices++;
+   }
+-  else if(iOccupiedDevices > 0) // Dauerleuchten
+-  {
+-    for(int i=0;i<MAXCYCLE;i++)
+-		iLedStatus[i] |=  LEDREC; // Bit setzen
+-  }
+-  else // LED aus
+-  {
+-    for(int i=0;i<MAXCYCLE;i++)
+-		iLedStatus[i] &= ~LEDREC; // Bit loeschen
++
++  if(iNumDevices == iOccupiedDevices) {                  // Blinken
++    for(i=0;i<MAXCYCLE;i++) {
++      if (i<SerialSetup.iFlash) iLedStatus[i] |=  LEDREC;    // Bit setzen
++      else  iLedStatus[i] &= ~LEDREC;                        // Bit loeschen
++    }
++  } else if(iOccupiedDevices > 0) {                      // Dauerleuchten
++    for(i=0;i<MAXCYCLE;i++) iLedStatus[i] |=  LEDREC;        // Bit setzen
++  } else {                                               // LED aus
++    for(i=0;i<MAXCYCLE;i++) iLedStatus[i] &= ~LEDREC;        // Bit loeschen
+   }
+-  return iLedStatus[i % MAXCYCLE];
++  return iLedStatus[j % MAXCYCLE];
+ }
+ 
+-void cSerialStatus::Recording(const cDevice *Device, const char *Name)
+-{
+-	int iCardIndex = Device->CardIndex();
+-	iNumDevices = Device->NumDevices();
++//void cSerialStatus::Recording(const cDevice *Device, const char *Name) {
++void cSerialStatus::Recording(const cDevice *Device, const char *Name, const char *FileName, bool On) {
++  int iCardIndex = Device->CardIndex();
++  iNumDevices = Device->NumDevices();
+ 
+-	if(iCardIndex < MAXDEVICES)
+-	{ 
+-		if(Name && Name[0])
+-			iCardIsRecording[iCardIndex]++;
+-		else
+-			iCardIsRecording[iCardIndex]--;
+-	}
++  if(iCardIndex < MAXDEVICES) {
++    if(Name && Name[0]) iCardIsRecording[iCardIndex]++;
++    else                iCardIsRecording[iCardIndex]--;
++  }
+ }
+ 
+ class cSerialRemote : public cRemote, private cThread
+ {
+ private:
+-	int fd;
+-	int iCycle;
+-	virtual void Action(void);
+-	virtual void SetState(void);
+-	cSerialStatus *cSSstat;
++  int fd;
++  int iCycle;
++  virtual void Action(void);
++  virtual void SetState(void);
++  cSerialStatus *cSSstat;
+ 
+ public:
+-	cSerialRemote(cSerialStatus *stat);
+-	virtual ~cSerialRemote(void);
+-	int Open(const char *device, cSerialStatus *stat);
+-	void Close(int fd);
++  cSerialRemote(cSerialStatus *stat);
++  virtual ~cSerialRemote(void);
++  int Open(const char *device, cSerialStatus *stat);
++  void Close(int fd);
+ };
+ 
+-
+ cSerialRemote::cSerialRemote(cSerialStatus *stat)
+-	:cRemote("Serial")
++  :cRemote("Serial")
+ {
+-	fd = Open(SerPort[SerialSetup.Port], stat);
++  fd = Open(SerPort[SerialSetup.Port], stat);
+ }
+ 
+ cSerialRemote::~cSerialRemote()
+ {
+-	int state = 0;
+-	ioctl(fd, TIOCMSET, &state);
+-	Cancel();
++  int state = 0;
++  ioctl(fd, TIOCMSET, &state);
++  Cancel();
+ }
+ 
+ void cSerialRemote::SetState(void)
+@@ -174,138 +166,149 @@
+ 
+ void cSerialRemote::Action(void)
+ {
+-	dsyslog("Serial remote control thread started (pid=%d)", getpid());
++  dsyslog("Serial remote control thread started (pid=%d)", getpid());
++
++  int state = 0;
++  int button = 0;
++  int xbutton = 0;
++  int dl = 0;
++  char str[32];
+ 
+-	int state = 0;
+-	int button = 0;
+-	char str[32];
+-	
+-	while(fd >= 0)
+-	{
+-		ioctl(fd, TIOCMGET, &state);
+-		button = 0;
+-		if(state & TIOCM_CTS)
+-			button += 1;
+-		if(state & TIOCM_DSR)
+-			button += 2;
+-		if(state & TIOCM_RNG)
+-			button += 4;
+-		if(state & TIOCM_CAR)
+-			button += 8;
+-		if(button > 0)
+-		{
+-			sprintf(str, "Button%d", button);
+-			Put(str);
+-		}
+-		SetState();
+-		usleep(100000);
+-	}
+-	dsyslog("Serial remote control thread ended (pid=%d)", getpid());
++  while(fd >= 0)
++  {
++    ioctl(fd, TIOCMGET, &state);
++    xbutton = button;
++    button = 0;
++    if(state & TIOCM_CTS) button += 1;
++    if(state & TIOCM_DSR) button += 2;
++    if(state & TIOCM_RNG) button += 4;
++    if(state & TIOCM_CAR) button += 8;
++
++    if ((xbutton != button) && !((button == 0) || (xbutton == 0))) button = xbutton;
++
++    if((xbutton != button) || ((dl >= SerialSetup.kpDelay) && (SerialSetup.kpDelay != MAXDELAY)))
++      dl = 0;
++    else {
++      if (dl > MAXDELAY) dl = MAXDELAY; //um überlauf zu vermeiden
++      dl++;
++    }
++
++    if((button > 0) && (dl == 0))
++    {
++      sprintf(str, "Button%d", button);
++      Put(str);
++    }
++    SetState();
++    usleep(100000);
++  }
++  dsyslog("Serial remote control thread ended (pid=%d)", getpid());
+ }
+ 
+ int cSerialRemote::Open(const char *device, cSerialStatus *stat)
+ {
+-	int fd = 0;
+-	int state = 0;
+-	cSSstat = stat;	
+-	iCycle = 0;
+-	
+-	fd = open(device , O_RDONLY | O_NDELAY);
+-	if(fd >= 0)
+-	{
+-			/* Set DTR to high */
+-		state |= TIOCM_DTR;
+-		ioctl(fd, TIOCMSET, &state);
+-		Start();
+-		return fd;
+-	}
+-	return -1;  
++  int fd = 0;
++  int state = 0;
++  cSSstat = stat;
++  iCycle = 0;
++
++  fd = open(device , O_RDONLY | O_NDELAY);
++  if(fd >= 0)
++  {
++      /* Set DTR to high */
++    state |= TIOCM_DTR;
++    ioctl(fd, TIOCMSET, &state);
++    Start();
++    return fd;
++  }
++  return -1;
+ }
+ 
+ void cSerialRemote::Close(int fd)
+ {
+-	if(fd >= 0)
+-	  close(fd);
++  if(fd >= 0)
++    close(fd);
+ }
+ 
+ class cPluginSerial : public cPlugin
+ {
+ private:
+-	// Add any member variables or functions you may need here.
+-	cSerialRemote *ser;
+-	cSerialStatus *stat;
++  // Add any member variables or functions you may need here.
++  cSerialRemote *ser;
++  cSerialStatus *stat;
+ public:
+-	cPluginSerial(void);
+-	virtual ~cPluginSerial();
+-	virtual const char *Version(void) { return VERSION; }
+-	virtual const char *Description(void) { return DESCRIPTION; }
+-	virtual const char *CommandLineHelp(void);
+-	virtual bool ProcessArgs(int argc, char *argv[]);
+-	virtual bool Start(void);
+-	virtual void Housekeeping(void);
+-	virtual const char *MainMenuEntry(void) { return NULL; }
+-	virtual cOsdObject *MainMenuAction(void);
+-	virtual cMenuSetupPage *SetupMenu(void);
+-	virtual bool SetupParse(const char *Name, const char *Value);
++  cPluginSerial(void);
++  virtual ~cPluginSerial();
++  virtual const char *Version(void) { return VERSION; }
++  virtual const char *Description(void) { return DESCRIPTION; }
++  virtual const char *CommandLineHelp(void);
++  virtual bool ProcessArgs(int argc, char *argv[]);
++  virtual bool Start(void);
++  virtual void Housekeeping(void);
++  virtual const char *MainMenuEntry(void) { return NULL; }
++  virtual cOsdObject *MainMenuAction(void);
++  virtual cMenuSetupPage *SetupMenu(void);
++  virtual bool SetupParse(const char *Name, const char *Value);
+ };
+ 
+ cPluginSerial::cPluginSerial(void)
+ {
+-	// Initialize any member variables here.
+-	// DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
+-	// VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
++  // Initialize any member variables here.
++  // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
++  // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
+ }
+ 
+ cPluginSerial::~cPluginSerial()
+ {
+-	// Clean up after yourself!
++  // Clean up after yourself!
+ }
+ 
+ const char *cPluginSerial::CommandLineHelp(void)
+ {
+-	// Return a string that describes all known command line options.
+-	return NULL;
++  // Return a string that describes all known command line options.
++  return NULL;
+ }
+ 
+ bool cPluginSerial::ProcessArgs(int argc, char *argv[])
+ {
+-	// Implement command line argument processing here if applicable.
+-	return true;
++  // Implement command line argument processing here if applicable.
++  return true;
+ }
+ 
+ bool cPluginSerial::Start(void)
+ {
+-	// Start any background activities the plugin shall perform.
+-	stat = new cSerialStatus();
+-	ser  = new cSerialRemote(stat);
+-	RegisterI18n(Phrases);
+-	return true;
++  // Start any background activities the plugin shall perform.
++  stat = new cSerialStatus();
++  ser  = new cSerialRemote(stat);
++  RegisterI18n(Phrases);
++  return true;
+ }
+ 
+ void cPluginSerial::Housekeeping(void)
+ {
+-	// Perform any cleanup or other regular tasks.
++  // Perform any cleanup or other regular tasks.
+ }
+ 
+ cOsdObject *cPluginSerial::MainMenuAction(void)
+ {
+-	// Perform the action when selected from the main VDR menu.
+-	return NULL;
++  // Perform the action when selected from the main VDR menu.
++  return NULL;
+ }
+ 
+ cMenuSetupPage *cPluginSerial::SetupMenu(void)
+ {
+-	// Return a setup menu in case the plugin supports one.
+-	return new cMenuSetupSerial;
++  // Return a setup menu in case the plugin supports one.
++  return new cMenuSetupSerial;
+ }
+ 
+ bool cPluginSerial::SetupParse(const char *Name, const char *Value)
+ {
+-	// Parse your own setup parameters and store their values.
++  // Parse your own setup parameters and store their values.
+   if (!strcasecmp(Name,"Flashrate"))
+-  	SerialSetup.iFlash = atoi(Value);
++    SerialSetup.iFlash = atoi(Value);
+   else if (!strcasecmp(Name,"Port"))
+     SerialSetup.Port = atoi(Value);
++  else if (!strcasecmp(Name,"KeyPressDelay"))
++    SerialSetup.kpDelay = atoi(Value);
+   else
+     return false;
+ 




More information about the pkg-vdr-dvb-changes mailing list