* Uses usbconfig to determine the Model 01's USB modem port. * Works around incompatibe avrsize flags. You need to be able to run usbconfig to flash the firmware from the buildtools. This can be accomplished with appropriate groups and devfs rules. Requires gmake, perl, avrdude, and (probably) arduino18 from ports. The version of avrdude in ports uses an avr-size command that doesn't understand the -C or --mcu flags. From what I can tell, these flags are uneccessary, as the size computed with them is the same as what you get from adding up the appropriate segments from the standard output of avr-size without any flags. However, since the size is only informative, I've opted to simply check to see if the command succeeded, and if not, output a string saying it could not be. It would probably be better to: * Determine appropriate flags based on build tools, or, * Just not use the flags at all, and grab the .text, etc., segment sizes from the standard output and add them up via `dc` for display. I've been using this toolchain to build successfully on FreeBSD 12 for the Model 01 without issue. It should work with earlier versions of FreeBSD as well. Signed-off-by: Brian Cully <bjc@kublai.com>pull/480/head
parent
819ab0760f
commit
39d1f70812
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
#
|
||||
# Scan all USB devices to find the Model 01's modem device number.
|
||||
#
|
||||
my @output = qx(/usr/sbin/usbconfig show_ifdrv);
|
||||
my $serial_port_number;
|
||||
|
||||
foreach my $line (@output) {
|
||||
chomp $line;
|
||||
|
||||
next unless $line =~ m/umodem(\d+):.*Keyboardio Model 01/;
|
||||
$serial_port_number = $1;
|
||||
}
|
||||
|
||||
die "Can't find Model 01" unless defined($serial_port_number);
|
||||
|
||||
my $serial_port_name = "/dev/cuaU$serial_port_number";
|
||||
die "Missing serial port at $serial_port_name" unless -e $serial_port_name;
|
||||
print "$serial_port_name\n";
|
||||
exit 0;
|
Loading…
Reference in new issue