summaryrefslogtreecommitdiff
path: root/ci.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-10-31 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-10-31 18:00:00 +0100
commit99e3c093f404b55683a90e38bbe74e1f51c35316 (patch)
treeed19caa03a60230d65a210a213d35bf62ed9f55f /ci.c
parent88d8d634089bae65bdfea8238a847b7883058072 (diff)
downloadvdr-patch-lnbsharing-99e3c093f404b55683a90e38bbe74e1f51c35316.tar.gz
vdr-patch-lnbsharing-99e3c093f404b55683a90e38bbe74e1f51c35316.tar.bz2
Version 1.3.35vdr-1.3.35
- Updated 'sources.conf' (thanks to Philip Prindeville). - Now using daemon() instead of fork() to run VDR in daemon mode (thanks to Enrico Scholz). - Fixed a possible endless loop in a menu with no selectable items if Setup.MenuScrollWrap is true (thanks to Enrico Scholz). - Making sure no item is displayed as "current" if Up, Down, Left or Right is pressed in a menu with no selectable items. - Added '__attribute__' to functions that use printf() like parameters (thanks to Darren Salt). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Fixed a leftover 'summary.vdr' in vdr.1 (reported by Christoph Hermanns). - Added more error messages and line numbers when reading EPG data and info.vdr (thanks to Peter Bieringer). - Updated the Danish OSD texts (thanks to Mogens Elneff). - Updated the Estonian OSD texts (thanks to Arthur Konovalov). - Added missing mutex locks to cCiMenu::Abort() and cCiEnquiry::Abort() (reported by Marco Schlüßler). - Fixed lock handling in CAM communication to avoid problems with multiple CAMs per device or CAMs with more than one smart card. - Updated the Greek OSD texts (thanks to Dimitrios Dimitrakos). - Updated the French OSD texts (thanks to Nicolas Huillard). - Fixed the cFilter example in PLUGINS.html (reported by Patrick Fischer). - The new class cUnbufferedFile is used for the recording files to avoid trashing the file system cache (based on a patch by Ralf Müller).
Diffstat (limited to 'ci.c')
-rw-r--r--ci.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/ci.c b/ci.c
index 9e86c61..4e63fde 100644
--- a/ci.c
+++ b/ci.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: ci.c 1.36 2005/10/03 12:58:22 kls Exp $
+ * $Id: ci.c 1.38 2005/10/30 13:04:10 kls Exp $
*/
#include "ci.h"
@@ -156,7 +156,7 @@ public:
uint8_t Status(void);
int Write(int fd);
int Read(int fd);
- void Dump(bool Outgoing);
+ void Dump(int fd, bool Outgoing);
};
cTPDU::cTPDU(uint8_t Slot, uint8_t Tcid, uint8_t Tag, int Length, const uint8_t *Data)
@@ -207,9 +207,9 @@ cTPDU::cTPDU(uint8_t Slot, uint8_t Tcid, uint8_t Tag, int Length, const uint8_t
int cTPDU::Write(int fd)
{
- Dump(true);
+ Dump(fd, true);
if (size)
- return write(fd, data, size) == size ? OK : ERROR;
+ return safe_write(fd, data, size) == size ? OK : ERROR;
esyslog("ERROR: attemp to write TPDU with zero size");
return ERROR;
}
@@ -222,20 +222,20 @@ int cTPDU::Read(int fd)
size = 0;
return ERROR;
}
- Dump(false);
+ Dump(fd, false);
return OK;
}
-void cTPDU::Dump(bool Outgoing)
+void cTPDU::Dump(int fd, bool Outgoing)
{
if (DumpTPDUDataTransfer) {
#define MAX_DUMP 256
- fprintf(stderr, "%s ", Outgoing ? "-->" : "<--");
+ fprintf(stderr, "%2d %s ", fd, Outgoing ? "-->" : "<--");
for (int i = 0; i < size && i < MAX_DUMP; i++)
fprintf(stderr, "%02X ", data[i]);
fprintf(stderr, "%s\n", size >= MAX_DUMP ? "..." : "");
if (!Outgoing) {
- fprintf(stderr, " ");
+ fprintf(stderr, " ");
for (int i = 0; i < size && i < MAX_DUMP; i++)
fprintf(stderr, "%2c ", isprint(data[i]) ? data[i] : '.');
fprintf(stderr, "%s\n", size >= MAX_DUMP ? "..." : "");
@@ -1048,12 +1048,12 @@ cCiMMI::cCiMMI(int SessionId, cCiTransportConnection *Tc)
cCiMMI::~cCiMMI()
{
if (fetchedMenu) {
- cMutexLock MutexLock(&fetchedMenu->mutex);
+ cMutexLock MutexLock(fetchedMenu->mutex);
fetchedMenu->mmi = NULL;
}
delete menu;
if (fetchedEnquiry) {
- cMutexLock MutexLock(&fetchedEnquiry->mutex);
+ cMutexLock MutexLock(fetchedEnquiry->mutex);
fetchedEnquiry->mmi = NULL;
}
delete enquiry;
@@ -1227,7 +1227,7 @@ cCiMenu::cCiMenu(cCiMMI *MMI, bool Selectable)
cCiMenu::~cCiMenu()
{
- cMutexLock MutexLock(&mutex);
+ cMutexLock MutexLock(mutex);
if (mmi)
mmi->Menu(true);
free(titleText);
@@ -1254,7 +1254,8 @@ bool cCiMenu::HasUpdate(void)
bool cCiMenu::Select(int Index)
{
- cMutexLock MutexLock(&mutex);
+ cMutexLock MutexLock(mutex);
+ dbgprotocol("%d: ==> Select %d\n", mmi ? mmi->SessionId() : -1, Index);
if (mmi && -1 <= Index && Index < numEntries)
return mmi->SendMenuAnswer(Index + 1);
return false;
@@ -1267,6 +1268,7 @@ bool cCiMenu::Cancel(void)
bool cCiMenu::Abort(void)
{
+ cMutexLock MutexLock(mutex);
return mmi && mmi->SendCloseMMI();
}
@@ -1282,7 +1284,7 @@ cCiEnquiry::cCiEnquiry(cCiMMI *MMI)
cCiEnquiry::~cCiEnquiry()
{
- cMutexLock MutexLock(&mutex);
+ cMutexLock MutexLock(mutex);
if (mmi)
mmi->Enquiry(true);
free(text);
@@ -1290,7 +1292,7 @@ cCiEnquiry::~cCiEnquiry()
bool cCiEnquiry::Reply(const char *s)
{
- cMutexLock MutexLock(&mutex);
+ cMutexLock MutexLock(mutex);
return mmi ? mmi->SendAnswer(s) : false;
}
@@ -1301,6 +1303,7 @@ bool cCiEnquiry::Cancel(void)
bool cCiEnquiry::Abort(void)
{
+ cMutexLock MutexLock(mutex);
return mmi && mmi->SendCloseMMI();
}
@@ -1617,8 +1620,12 @@ cCiMenu *cCiHandler::GetMenu(void)
cMutexLock MutexLock(&mutex);
for (int Slot = 0; Slot < numSlots; Slot++) {
cCiMMI *mmi = (cCiMMI *)GetSessionByResourceId(RI_MMI, Slot);
- if (mmi)
- return mmi->Menu();
+ if (mmi) {
+ cCiMenu *Menu = mmi->Menu();
+ if (Menu)
+ Menu->mutex = &mutex;
+ return Menu;
+ }
}
return NULL;
}
@@ -1628,8 +1635,12 @@ cCiEnquiry *cCiHandler::GetEnquiry(void)
cMutexLock MutexLock(&mutex);
for (int Slot = 0; Slot < numSlots; Slot++) {
cCiMMI *mmi = (cCiMMI *)GetSessionByResourceId(RI_MMI, Slot);
- if (mmi)
- return mmi->Enquiry();
+ if (mmi) {
+ cCiEnquiry *Enquiry = mmi->Enquiry();
+ if (Enquiry)
+ Enquiry->mutex = &mutex;
+ return Enquiry;
+ }
}
return NULL;
}