Created
February 10, 2020 22:28
-
-
Save cowens/d9bedf87918b3fc04d10d61f6905e23e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
open my $co2, "+>", "/dev/io8log" or die "$!"; | |
my $message = pack "C*", 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80; | |
my $ret = ioctl $co2, 0xC0094806, $message; | |
while (1) { | |
my $bytes = read $co2, my $buf, 8; | |
die "$bytes is not enough" unless $bytes == 8; | |
my @values = unpack "C*", $buf; | |
print join(" ", map { sprintf "%02x", $_ } @values), "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment