-my $device = $ENV{DEVICE} || '/dev/ttyUSB2'; # last device! control port!
+my $device = shift @ARGV || $ENV{DEVICE} || '/dev/ttyUSB2'; # last device! control port!
my $port = Device::SerialPort->new( $device ) || die "$device: $!";
$port->baudrate(115200) || die "fail $device baudrate";
$port->read_const_time(3000); # 1 s read timeout
while ( my $drain = $port->input ) {
- warn "# drain $drain\n# /drain\n";
+ warn "# drain $drain\n";
+
+ $port->write('AT$QCDMG' . "\r");
+ warn "DIAG mode: ", $port->read(2), $port->input; # OK+cr/lf
+
}
my $diag = {
warn "## using $device\n";
-#$port->write('AT$QCDMG');
-#warn "DIAG mode: ", $port->read(2), $port->input; # OK+cr/lf
-
sub as_hex {
my @out;
foreach my $str ( @_ ) {