Skip to content

Commit f0366f9

Browse files
committed
macOS compatibility
1 parent 0a46cb7 commit f0366f9

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

Cmd_Devices.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ int Command_Devices(const std::vector<std::string>& args) {
3333
try {
3434
#endif
3535
tty.make_raw();
36-
tty.speed() = 2000000;
3736
#ifdef __CYGWIN__
3837
} catch (...) {
3938

Cmd_Env.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ int Command_Env(const std::vector<std::string>& args) {
192192
try {
193193
#endif
194194
tty.make_raw();
195-
tty.speed() = 2000000;
196195
#ifdef __CYGWIN__
197196
} catch (...) {
198197

Cmd_Erase.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ int Command_Erase(const std::vector<std::string>& args) {
5353
try {
5454
#endif
5555
tty.make_raw();
56-
tty.speed() = 2000000;
5756
#ifdef __CYGWIN__
5857
} catch (...) {
5958

Cmd_Flash.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,19 @@ int Command_Flash(const std::vector<std::string>& args) {
4646
try {
4747
#endif
4848
tty.make_raw();
49-
tty.speed() = 2000000;
5049
#ifdef __CYGWIN__
5150
} catch (...) {
5251

5352
}
5453
#endif
5554

55+
56+
5657
std::ifstream infile(filepath);
58+
if (!infile.good()) {
59+
printf("error: unable to open file `%s'\n", filepath.c_str());
60+
return 2;
61+
}
5762
infile.seekg(0, std::ios_base::end);
5863
size_t infile_size = infile.tellg();
5964
infile.seekg(0, std::ios_base::beg);

Cmd_Info.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,26 @@ int Command_Info(const std::vector<std::string>& args) {
3737
try {
3838
#endif
3939
tty.make_raw();
40-
tty.speed() = 2000000;
4140
#ifdef __CYGWIN__
4241
} catch (...) {
4342

4443
}
4544
#endif
4645

4746
auto info_bl_ver = serial_chat(tty, FlasherCommand_GetBootloaderVersion, nullptr);
48-
*info_bl_ver.end() = 0;
47+
info_bl_ver.back() = 0;
4948

5049
auto info_board = serial_chat(tty, FlasherCommand_GetBoardName, nullptr);
51-
*info_board.end() = 0;
50+
info_board.back() = 0;
5251

5352
auto info_board_mf = serial_chat(tty, FlasherCommand_GetBoardManufacturer, nullptr);
54-
*info_board_mf.end() = 0;
53+
info_board_mf.back() = 0;
5554

5655
auto info_chip = serial_chat(tty, FlasherCommand_GetChipName, nullptr);
57-
*info_chip.end() = 0;
56+
info_chip.back() = 0;
5857

5958
auto info_chip_mf = serial_chat(tty, FlasherCommand_GetChipManufacturer, nullptr);
60-
*info_chip_mf.end() = 0;
59+
info_chip_mf.back() = 0;
6160

6261
printf("Device: %s\n", global_device_path.c_str());
6362
puts("");

Cmd_Reboot.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ int Command_Reboot(const std::vector<std::string>& args) {
4545
try {
4646
#endif
4747
tty.make_raw();
48-
tty.speed() = 2000000;
4948
#ifdef __CYGWIN__
5049
} catch (...) {
5150

PICoBoot_Utility.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void ShowHelpExtra() {
5252
std::string global_device_path;
5353

5454
int main(int argc, char **argv) {
55-
cxxopts::Options options("picoboot", "picoboot - Bootloader tool for the PotatoPi PICo series.");
55+
cxxopts::Options options("picoboot", "picoboot - Utility for the PICoBoot bootloader.");
5656

5757
std::vector<std::string> positional_args;
5858

ScanDevice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
std::vector<std::string> ScanDevice_GetAllTTYs() {
2323
std::vector<std::string> ret;
2424

25-
for (const auto &dirEntry : std::filesystem::recursive_directory_iterator("/dev/")) {
25+
for (const auto &dirEntry : std::filesystem::directory_iterator("/dev/")) {
2626
auto p = dirEntry.path().string();
2727
#if defined(__linux__)
2828
const char keyword[] = "/ttyACM";

0 commit comments

Comments
 (0)