Silent-Tears
IPPF-Promi
- Mitglied seit
- 3 Aug 2007
- Beiträge
- 7,456
- Punkte für Reaktionen
- 1
- Punkte
- 0
Webcam? Oscam? Ist doch alle das gleiche... :mrgreen:
Bei manchen Sendern nimmt sich das sicher nix
Webcam? Oscam? Ist doch alle das gleiche... :mrgreen:
echo -e '\xff\x01\x01' > /dev/ttyUSB1
sleep 3
echo -e '\xff\x01\x00' > /dev/ttyUSB1
#define REL_off "echo -e '\xff\x01\x00' > /dev/ttyUSB1"
#define REL_on "echo -e '\xff\x01\x01' > /dev/ttyUSB1"
system (REL_BAUD);
printf("Relais BAUD\n");
system (REL_on);
printf("Relais Ein\n");
sleep (10);
system (REL_BAUD);
printf("Relais BAUD\n");
system (REL_off);
printf("Relais Aus\n");
root@erwin-desktop:/home/yasdi/smalog# ./smalog /home/yasdi/smalog/smalog.conf
Relais BAUD
Relais Ein
Relais BAUD
sh: Syntax error: Unterminated quoted string
Relais Aus
if ((fd = open(REL_DEVICE, O_RDWR)) == -1)
{
perror("terminal: Can't open device " REL_DEVICE);
// return(1);
}
unsigned char buffer1[4];
int n1;
buffer1[0] = 0xff; // Init
buffer1[1] = 0x01; // Adress 1
buffer1[2] = 0x00; // 0x00 für aus
buffer1[3] = buffer1[0] ^ buffer1[1] ^ buffer1[2];
// berechnung für Fehlerkorrektur
n1 = write (fd,buffer1,sizeof(buffer1));
if (n1 < 0)
{
fprintf(stderr,"Unable to write Relais");
// return 1;
}
printf("Relais Aus\n");
# define TERM_DEVICE "/dev/ttyUSB0" /* = COM1 / USB */
# define TERM_SPEED B19200 /* Bit/Sek */
..........
if ((fd = open(TERM_DEVICE, O_RDWR)) == -1)
{
perror("terminal: Can't open device " TERM_DEVICE);
return(1);
}
/* RS232 konfigurieren */
if (tcgetattr(fd, &term_attr) != 0)
{
perror("terminal: tcgetattr() failed");
return(1);
}
term_attr.c_cflag = TERM_SPEED | CS8 | CLOCAL | CREAD;
term_attr.c_iflag = 0;
term_attr.c_oflag = OPOST | ONLCR;
term_attr.c_lflag = 0;
if (tcsetattr(fd, TCSAFLUSH, &term_attr) != 0)
perror("terminal: tcsetattr() failed");
/* Std.-Eingabe anpassen */
tcgetattr(STDIN_FILENO, &term_attr) ;
/* alte Einst. sichern */
old_flags = term_attr.c_lflag;
term_attr.c_lflag &= ~(ICANON | ECHO);
tcsetattr(STDIN_FILENO, TCSAFLUSH, &term_attr) ;
message_power[0] = 0x16;
message_power[1] = 0x10;
message_power[2] = 0x02; //
message_power[3] = 0x10;
message_power[4] = 0x10; //
message_power[5] = 0x4A; //
message_power[6] = 0xA6; //
message_power[7] = 0x9C; //
message_power[8] = 0x40;
message_power[9] = 0x0A;
message_power[10] = 0xA7;
message_power[11] = 0x81; //
message_power[12] = 0xF2;
message_power[13] = 0x00; //
message_power[14] = 0x00; //
message_power[15] = 0x28; //
message_power[16] = 0x00; //
message_power[17] = 0x08;
message_power[18] = 0x00;
message_power[19] = 0x11;
message_power[20] = 0x00; //
message_power[21] = 0x14;
message_power[22] = 0x00; //
message_power[23] = 0x17; //
message_power[24] = 0x00; //
message_power[25] = 0x1A; //
message_power[26] = 0x00;
message_power[27] = 0x1D;
message_power[28] = 0x00;
message_power[29] = 0x20; //
message_power[30] = 0x00;
message_power[31] = 0x24; //
message_power[32] = 0x00; //
message_power[33] = 0x25; //
message_power[34] = 0x10; //
message_power[35] = 0x03;
message_power[36] = 0x51;
message_power[37] = 0x22;
n = write(fd,message_power,38);
if (n < 0) {
close(fd);
error_retry("ERROR sending TCP packet");
break;
}
if (DEBUG)
printf("\nWR= message gesendet: %s\n", message_power);
sleep (1) ;
if ((fd = open(TERM_DEVICE, O_RDWR)) == -1)
{
perror("terminal: Can't open device " TERM_DEVICE);
return(1);
}
/* RS232 konfigurieren */
if (tcgetattr(fd, &term_attr) != 0)
{
perror("terminal: tcgetattr() failed");
return(1);
}
term_attr.c_cflag = TERM_SPEED | CS8 | CLOCAL | CREAD;
term_attr.c_iflag = 0;
term_attr.c_oflag = 0;
term_attr.c_lflag = 0;
if (tcsetattr(fd, TCSAFLUSH, &term_attr) != 0)
perror("terminal: tcsetattr() failed");
/* Std.-Eingabe anpassen */
tcgetattr(STDIN_FILENO, &term_attr) ;
/* alte Einst. sichern */
old_flags = term_attr.c_lflag;
term_attr.c_lflag &= ~(ICANON | ECHO);
tcsetattr(STDIN_FILENO, TCSAFLUSH, &term_attr) ;
.........................................
// Read answer
bzero(buffer, 256);
n = read(fd, buffer, 255);
for (counter = 0; counter < 100 && n < 0; counter++) {
if (DEBUG)
debug_entry("Socket contains no data, trying to read again later");
usleep(10000);
n = read(fd, buffer, 255);
}
if (n < 0) {
close(fd);
error_retry("ERROR receiving TCP packet");
break;
}
term_attr.c_cc[VTIME] = 5;
term_attr.c_cc[VMIN] = 10;
Passiert das denn grundsätzlich, dass der Wert 16 doppelt kommt?
.
Welche Werte hast Du gesetzt, und wobei kam keine Veränderung?Ich werde das mit MIN und TIME versuchen.
Ich habe jetzt beide Variablen gesetzt. Keine Veränderung!
Received answer b0: 22
Received answer b1: 16
Received answer b2: 2
Received answer b3: 64
Received answer b4: 10
Received answer b5: -89
Received answer b6: -127
Received answer b7: 16
Received answer b8: 16 kein Fehler
Received answer b9: 74
Received answer b10: -90
Received answer b11: -100
Received answer b12: 114
Received answer b13: 0
Received answer b14: 18
Received answer b15: 80
Received answer b16: 86
Received answer b17: 45
Received answer b18: 83
Received answer b19: 89
Received answer b20: 83
Received answer b21: 84
Received answer b22: 69
Received answer b23: 77
Received answer b24: 32
Received answer b25: 32
Received answer b26: 32
Received answer b27: 32
Received answer b28: 32
Received answer b29: 32
Received answer b30: 32
Received answer b31: 32
Received answer b32: 32
Received answer b33: 80
Received answer b34: 114
Received answer b35: 115
Received answer b36: 50
Received answer b37: 1
Received answer b38: -64
Received answer b39: 0
Received answer b40: 8
Received answer b41: 1
Received answer b42: 125
Received answer b43: 0
Received answer b44: -28
Received answer b45: 0
Received answer b46: 16
Received answer b47: 16 >>>>>>>>>>>>>>> Fehler
Received answer b48: 1
Received answer b49: 110
Received answer b50: 0
Received answer b51: 0
Received answer b52: 0
Received answer b53: 77
Received answer b54: 0
Received answer b55: 32
Received answer b56: -92
Received answer b57: -104
Received answer b58: 16
Received answer b59: 3
Received answer b60: -116
Received answer b37: 1
Received answer b38: 192
Received answer udc: 448
Received answer b39: 0
Received answer b40: 8
Received answer idc: 8
Received answer b41: 1
Received answer b42: 125
Received answer pdc: 381
Received answer b43: 0
Received answer b44: 228
Received answer ul1: 228
Received answer b45: 0
Received answer b46: 16
Received answer il1: 16
Received answer b47: 16 >>>>>>>>>>>>>>> Fehler
Received answer b48: 1
Received answer pac: 4097
Received answer b49: 110
Received answer b50: 0
Received answer b51: 0
Received answer b52: 0
Received answer kdy: 7208960
Received answer b53: 77
Received answer b54: 0
Received answer b55: 32
Received answer b56: 164
Received answer kt0: 5054628
dataok ==..............: 1
Received answer pdc 381
Received answer pac 4097
Received answer prl.................: 10753
dataok ==..............: 0
Received answer : @
��J��r
Received answer b0: 22
Received answer b1: 16 kein Fehler
Received answer b2: 2
Received answer b3: 64
Received answer b4: 10
Received answer b5: -89
Received answer b6: -127
Received answer b7: 16
Received answer b8: 16 kein Fehler
Received answer b9: 74
Received answer b10: -90
Received answer b11: -100
Received answer b12: 114
Received answer b13: 0
Received answer b14: 18
Received answer b15: 80
Received answer b16: 86
Received answer b17: 45
Received answer b18: 83
Received answer b19: 89
Received answer b20: 83
Received answer b21: 84
Received answer b22: 69
Received answer b23: 77
Received answer b24: 32
Received answer b25: 32
Received answer b26: 32
Received answer b27: 32
Received answer b28: 32
Received answer b29: 32
Received answer b30: 32
Received answer b31: 32
Received answer b32: 32
Received answer b33: 80
Received answer b34: 114
Received answer b35: 116
Received answer b36: -102
Received answer b37: 1
Received answer b38: -69
Received answer b39: 0
Received answer b40: 9
Received answer b41: 1
Received answer b42: -111
Received answer b43: 0
Received answer b44: -27
Received answer b45: 0
Received answer b46: 16
Received answer b47: 16 >>>>>>>>>>>>>>> Fehler
Received answer b48: 1
Received answer b49: -126
Received answer b50: 0
Received answer b51: 0
Received answer b52: 0
Received answer b53: 118
Received answer b54: 0
Received answer b55: 32
Received answer b56: -92
Received answer b57: -62
Received answer b58: 16 kein Fehler
Received answer b59: 3
Received answer b60: -7
Received answer b37: 1
Received answer b38: 187
Received answer udc: 443
Received answer b39: 0
Received answer b40: 9
Received answer idc: 9
Received answer b41: 1
Received answer b42: 145
Received answer pdc: 401
Received answer b43: 0
Received answer b44: 229
Received answer ul1: 229
Received answer b45: 0
Received answer b46: 16
Received answer il1: 16
Received answer b47: 16 >>>>>>>>>>>>>>> Fehler
Received answer b48: 1
Received answer pac: 4097
Received answer b49: 130
Received answer b50: 0
Received answer b51: 0
Received answer b52: 0
Received answer kdy: 8519680
Received answer b53: 118
Received answer b54: 0
Received answer b55: 32
Received answer b56: 164
Received answer kt0: 7741604
dataok ==..............: 1
Received answer pdc 401
Received answer pac 4097
Received answer prl.................: 10216
dataok ==..............: 0
Received answer b37: 1
Received answer b38: 200
Received answer udc: 456
Received answer b39: 0
Received answer b40: 17
Received answer idc: 17
Received answer b41: 3
Received answer b42: 38
Received answer pdc: 806
Received answer b43: 0
Received answer b44: 228
Received answer ul1: 228
Received answer b45: 0
Received answer b46: 34
Received answer il1: 34
Received answer b47: 3
Received answer b48: 16
Received answer pac: 784
Received answer b49: 16 >>>>>>>>>>>>>>> Fehler
Received answer b50: 0
Received answer b51: 0
Received answer b52: 2
Received answer kdy: 1048578
Received answer b53: 187
Received answer b54: 0
Received answer b55: 32
Received answer b56: 167
Received answer kt0: 12263591
dataok ==..............: 1
Received answer : @
��J��r
Received answer b0: 22
Received answer b1: 16
Received answer b2: 2
Received answer b3: 64
Received answer b4: 10
Received answer b5: -89
Received answer b6: -127
Received answer b7: 16
Received answer b8: 16
Received answer b9: 74
Received answer b10: -90
Received answer b11: -100
Received answer b12: 114
Received answer b13: 0
Received answer b14: 18
Received answer b15: 80
Received answer b16: 86
Received answer b17: 45
Received answer b18: 83
Received answer b19: 89
Received answer b20: 83
Received answer b21: 84
Received answer b22: 69
Received answer b23: 77
Received answer b24: 32
Received answer b25: 32
Received answer b26: 32
Received answer b27: 32
Received answer b28: 32
Received answer b29: 32
Received answer b30: 32
Received answer b31: 32
Received answer b32: 32
Received answer b33: 80
Received answer b34: 114
Received answer b35: -122
Received answer b36: 19
Received answer b37: 1
Received answer b38: -53
Received answer b39: 0
Received answer b40: 16
Received answer b41: 16 >>>>>>>>>>>>>>> Fehler
Received answer b42: 2
Received answer b43: -20
Received answer b44: 0
Received answer b45: -28
Received answer b46: 0
Received answer b47: 31
Received answer b48: 2
Received answer b49: -42
Received answer b50: 0
Received answer b51: 0
Received answer b52: 2
Received answer b53: -43
Received answer b54: 0
Received answer b55: 32
Received answer b56: -89
Received answer b57: 30
Received answer b58: 16
Received answer b59: 3
Received answer b60: 82
Received answer b37: 1
Received answer b38: 203
Received answer udc: 459
Received answer b39: 0
Received answer b40: 16
Received answer idc: 16
Received answer b41: 16 >>>>>>>>>>>>>>> Fehler
Received answer b42: 2
Received answer pdc: 4098
// term_attr.c_cc[VTIME] = 10;
// term_attr.c_cc[VMIN] = 61;
Received answer b51: 16
Received answer b52: 16
Received answer kdy: 4112
Received answer b53: 234
Received answer b54: 0
Received answer b55: 32
Received answer b56: 181
Received answer kt0: 153437
... Habt Ihr vielleicht eine Idee, was ich machen könnte, damit die Daten erhalten bleiben? ...