summaryrefslogtreecommitdiff
path: root/noncore/tools/remote/learntab.cpp
authorspiralman <spiralman>2002-07-24 22:40:52 (UTC)
committer spiralman <spiralman>2002-07-24 22:40:52 (UTC)
commite8b7ba4b8873e8ba389af86c45de83c04d73f453 (patch) (unidiff)
tree6e96c7ade32e11a4e35c79abee432995eb197ef6 /noncore/tools/remote/learntab.cpp
parent2d9c74a4995a949378b36469ae5c6ab77963bead (diff)
downloadopie-e8b7ba4b8873e8ba389af86c45de83c04d73f453.zip
opie-e8b7ba4b8873e8ba389af86c45de83c04d73f453.tar.gz
opie-e8b7ba4b8873e8ba389af86c45de83c04d73f453.tar.bz2
removed makefiles
Diffstat (limited to 'noncore/tools/remote/learntab.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/remote/learntab.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/tools/remote/learntab.cpp b/noncore/tools/remote/learntab.cpp
index 1c746c5..7582161 100644
--- a/noncore/tools/remote/learntab.cpp
+++ b/noncore/tools/remote/learntab.cpp
@@ -68,76 +68,76 @@ QStringList LearnTab::getRemotes()
68 int i, numlines; 68 int i, numlines;
69 QStringList list; 69 QStringList list;
70 70
71 addr.sun_family=AF_UNIX; 71 addr.sun_family=AF_UNIX;
72 strcpy(addr.sun_path,"/dev/lircd"); 72 strcpy(addr.sun_path,"/dev/lircd");
73 73
74 fd = socket(AF_UNIX, SOCK_STREAM, 0); 74 fd = socket(AF_UNIX, SOCK_STREAM, 0);
75 if(fd == -1) 75 if(fd == -1)
76 { 76 {
77 QMessageBox *mb = new QMessageBox("Error!", 77 QMessageBox *mb = new QMessageBox("Error!",
78 "couldnt connect to socket", 78 "couldnt connect to socket",
79 QMessageBox::NoIcon, 79 QMessageBox::NoIcon,
80 QMessageBox::Ok, 80 QMessageBox::Ok,
81 QMessageBox::NoButton, 81 QMessageBox::NoButton,
82 QMessageBox::NoButton); 82 QMessageBox::NoButton);
83 mb->exec(); 83 mb->exec();
84 perror("ButtonDialog::GetRemotes"); 84 perror("LearnTab::GetRemotes");
85 return NULL; 85 return NULL;
86 } 86 }
87 87
88 if(::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) 88 if(::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
89 { 89 {
90 QMessageBox *mb = new QMessageBox("Error!", 90 QMessageBox *mb = new QMessageBox("Error!",
91 "couldnt connect to socket", 91 "couldnt connect to socket",
92 QMessageBox::NoIcon, 92 QMessageBox::NoIcon,
93 QMessageBox::Ok, 93 QMessageBox::Ok,
94 QMessageBox::NoButton, 94 QMessageBox::NoButton,
95 QMessageBox::NoButton); 95 QMessageBox::NoButton);
96 mb->exec(); 96 mb->exec();
97 perror("ButtonDialog::GetRemotes"); 97 perror("LearnTab::GetRemotes");
98 return NULL; 98 return NULL;
99 } 99 }
100 100
101 write(fd, write_buffer, strlen(write_buffer)); 101 write(fd, write_buffer, strlen(write_buffer));
102 102
103 for(i=0; i<5; i++) 103 for(i=0; i<5; i++)
104 { 104 {
105 printf("%d\n", i); 105 printf("%d\n", i);
106 readbuffer = readPacket(); 106 readbuffer = readPacket();
107 printf("%s", readbuffer); 107 printf("%s", readbuffer);
108 printf("%d\n", i); 108 printf("%d\n", i);
109 } 109 }
110 110
111 numlines = atoi(readbuffer); 111 numlines = atoi(readbuffer);
112 112
113 for(i=0; i<numlines; i++) 113 for(i=0; i<numlines; i++)
114 { 114 {
115 list+=readPacket(); 115 list+=readPacket();
116 } 116 }
117 117
118 if(strcasecmp(readPacket(), "END") != 0) 118 if(strcasecmp(readPacket(), "END") != 0)
119 { 119 {
120 QMessageBox *mb = new QMessageBox("Error!", 120 QMessageBox *mb = new QMessageBox("Error!",
121 "bad packet", 121 "bad packet",
122 QMessageBox::NoIcon, 122 QMessageBox::NoIcon,
123 QMessageBox::Ok, 123 QMessageBox::Ok,
124 QMessageBox::NoButton, 124 QMessageBox::NoButton,
125 QMessageBox::NoButton); 125 QMessageBox::NoButton);
126 mb->exec(); 126 mb->exec();
127 perror("ButtonDialog::GetRemotes"); 127 perror("LearnTab::GetRemotes");
128 return NULL; 128 return NULL;
129 } 129 }
130 130
131 ::close(fd); 131 ::close(fd);
132 return list; 132 return list;
133} 133}
134 134
135//this function was ripped for rc.c in xrc, it is available here: http://www.lirc.org/software.html 135//this function was ripped for rc.c in xrc, it is available here: http://www.lirc.org/software.html
136const char *LearnTab::readPacket() 136const char *LearnTab::readPacket()
137{ 137{
138 static char buffer[PACKET_SIZE+1]=""; 138 static char buffer[PACKET_SIZE+1]="";
139 char *end; 139 char *end;
140 static int ptr=0,end_len=0; 140 static int ptr=0,end_len=0;
141 ssize_t ret; 141 ssize_t ret;
142 timeout = 0; 142 timeout = 0;
143 143