Rev 907 | Rev 974 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 907 | Rev 935 | ||
|---|---|---|---|
| Line 171... | Line 171... | ||
| 171 | my $newmsg; |
171 | my $newmsg; |
| 172 | my $retstring; |
172 | my $retstring; |
| 173 | 173 | ||
| 174 | ### Cut all leading chars that is not a start-char ### |
174 | ### Cut all leading chars that is not a start-char ### |
| 175 | for ($i = 0; $i < length($input); $i++) { |
175 | for ($i = 0; $i < length($input); $i++) { |
| - | 176 | if (ord(substr($input, 0, 1)) != $C2SSTARTSTR) { |
|
| 176 | if (ord(substr($input, $i, 1)) == $C2SSTARTSTR) { |
177 | if (ord(substr($input, $i, 1)) == $C2SSTARTSTR) { |
| 177 | $input = substr($input, $i); |
178 | $input = substr($input, $i); |
| 178 | $output = $input; |
179 | $output = $input; |
| 179 | #print "debug: cutting character\n"; |
180 | #print "debug: cutting character\n"; |
| 180 | break; |
181 | break; |
| 181 | } |
182 | } |
| 182 | if (ord(substr($input, $i, 1)) == $C2PINGSTR) { |
183 | if (ord(substr($input, $i, 1)) == $C2PINGSTR) { |
| 183 | print "Got pong from hardware\n"; |
184 | print "Got pong from hardware\n"; |
| 184 | $input = substr($input, $i+1); |
185 | $input = substr($input, $i+1); |
| 185 | $output = $input; |
186 | $output = $input; |
| - | 187 | } |
|
| - | 188 | } else { |
|
| - | 189 | break; |
|
| 186 | } |
190 | } |
| 187 | } |
191 | } |
| 188 | ### Check for possible complete packets ### |
192 | ### Check for possible complete packets ### |
| 189 | for ($i = 0; $i < length($input)-16; $i++) { |
193 | for ($i = 0; $i < length($input)-16; $i++) { |
| 190 | my $newmsg = substr($input, $i, 17); |
194 | my $newmsg = substr($input, $i, 17); |