Skip to content

Commit

Permalink
Fix bugs (write /dev/sda), remove module menu
Browse files Browse the repository at this point in the history
- add some error handling
  • Loading branch information
petabyt committed Apr 16, 2023
1 parent 1e763ed commit 4931ae9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ RM=rm -rf
all: unix-gtk

# flags for unix-gtk
unix-gtk: LDFLAGS=-lusb-1.0 $(shell pkg-config --libs gtk+-3.0)
unix-gtk: CFLAGS=$(shell pkg-config --cflags gtk+-3.0) -Icamlib/src -DVERBOSE
unix-gtk: LDFLAGS=$(shell pkg-config --libs gtk+-3.0) $(shell pkg-config --cflags --libs libusb-1.0)
unix-gtk: CFLAGS=$(shell pkg-config --cflags gtk+-3.0) $(shell pkg-config --cflags --libs libusb-1.0) -Icamlib/src -DVERBOSE

# Clean incompatible stuff, use between comiling
clean-out:
Expand Down
2 changes: 1 addition & 1 deletion camlib
11 changes: 6 additions & 5 deletions gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ int ptp_connect_init() {
}

ptp_runtime.di = (struct PtpDeviceInfo *)malloc(sizeof(struct PtpDeviceInfo));
r = ptp_get_device_info(&ptp_runtime, &ptp_runtime.di);
r = ptp_get_device_info(&ptp_runtime, ptp_runtime.di);
if (r) {
return r;
}
Expand Down Expand Up @@ -417,7 +417,7 @@ static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
return FALSE;
}

#define MENU_ADD_BUTTON(text, function, tip) \
#define MENU_ADD_BUTTON(text, function, tip) \
button = gtk_button_new_with_label(text); \
g_signal_connect(button, "clicked", G_CALLBACK(function), NULL); \
gtk_grid_attach(GTK_GRID(grid), button, 0, order++, 1, 1); \
Expand Down Expand Up @@ -448,7 +448,6 @@ int main(int argc, char *argv[])
g_print("https://www.magiclantern.fm/forum/index.php?topic=26162\n");

ptp_generic_init(&ptp_runtime);
//ptp_backend_init(&ptp_runtime);

window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "MLinstall");
Expand Down Expand Up @@ -561,7 +560,7 @@ int main(int argc, char *argv[])
label = gtk_label_new("Advanced");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), grid, label);

if (dev_flag) {
#if 0
grid = gtk_grid_new();
gtk_container_set_border_width(GTK_CONTAINER(grid), 10);
gtk_widget_show(grid);
Expand All @@ -571,8 +570,9 @@ int main(int argc, char *argv[])

label = gtk_label_new("Quick Install");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), grid, label);
}
#endif

#if 0
GtkWidget *scrollWindow = gtk_scrolled_window_new(NULL, NULL);
gtk_widget_show(scrollWindow);

Expand All @@ -586,6 +586,7 @@ int main(int argc, char *argv[])

label = gtk_label_new("App Store");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrollWindow, label);
#endif

gtk_grid_attach(GTK_GRID(mainGrid), logw, 0, 2, 1, 1);

Expand Down
7 changes: 2 additions & 5 deletions src/drive-unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ int drive_get(char buffer[], int n)
if (strncmp(buffer, "/dev/", 5)) {
puts("Make sure your EOS_DIGITAL card is mounted.");
return DRIVE_NONE;
} else if (!strncmp(buffer, "/dev/sda", 8)) {
puts("Somehow I got /dev/sda. I'm not writing to it...");
return DRIVE_NONE;
}

return 0;
Expand Down Expand Up @@ -122,7 +119,7 @@ int drive_get_usable(char buffer[], int n)
int drive_openfs()
{
if (geteuid() != 0) {
puts("This app must be run as superuser to modify filesystems, like: sudo ./mlinstall");
puts("mlinstall needs superuser permissions. (sudo ./mlinstall)");
return DRIVE_ERROR;
}

Expand All @@ -141,7 +138,7 @@ int drive_openfs()
puts("Error unmounting drive.");
return DRIVE_ERROR;
} else {
puts("Unmounted drive for filesystem safety.");
puts("Unmounted drive.");
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <ptp.h>

int ptp_canon_activate_command(struct PtpRuntime *r) {
for (int i = 0; i < 3; i++) {
for (int i = 0; i < 0; i++) {
struct PtpCommand cmd;
cmd.code = 0x9050;
cmd.param_length = 0;
Expand Down

0 comments on commit 4931ae9

Please sign in to comment.