FUSE fixes and updates for virtual drives

This commit is contained in:
dschmenk 2014-02-08 10:50:56 -08:00
parent 2aec13ef83
commit d8bf70b34d
8 changed files with 590 additions and 559 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
a2pi (0.1.8-1) unstable; urgency=low a2pi (0.1.8-2) unstable; urgency=low
* Fix FUSE create file function * Fix FUSE create file function
* Add VSDRIVE functionality * Add VSDRIVE functionality

12
debian/postinst vendored
View File

@ -60,12 +60,12 @@ case "$1" in
# #
# Set up VSDRIVEs # Set up VSDRIVEs
# #
if [ ! -f /usr/share/a2pid/A2VD1.PO ] ; then if [ ! -e /usr/share/a2pi/A2VD1.PO ] ; then
ln -s /usr/share/a2pid/A2PI-1.4.PO A2VD1.PO ln -s /usr/share/a2pi/A2PI-1.4.PO /usr/share/a2pi/A2VD1.PO
fin fi
if [ ! -f /usr/share/a2pid/A2VD2.PO ] ; then if [ ! -e /usr/share/a2pi/A2VD2.PO ] ; then
ln -s /usr/share/a2pid/BLANKDISK.PO A2VD2.PO ln -s /usr/share/a2pi/BLANK.PO /usr/share/a2pi/A2VD2.PO
fin fi
# #
# Add schmenk.is-a-geek.com to apt sources # Add schmenk.is-a-geek.com to apt sources
# #

View File

@ -7,7 +7,7 @@ else
BINDIR=$(DESTDIR)/usr/bin BINDIR=$(DESTDIR)/usr/bin
SHAREDIR=$(DESTDIR)/usr/share/a2pi SHAREDIR=$(DESTDIR)/usr/share/a2pi
endif endif
BIN=a2joy a2joymou a2joypad a2mon a2term fusea2pi dskread dskwrite bload brun BIN=a2joy a2joymou a2joypad a2mon a2term fusea2pi a2pidcmd dskread dskwrite bload brun
SBIN=a2pid SBIN=a2pid
A2PIDEFS=-DSETSERCLK A2PIDEFS=-DSETSERCLK
@ -25,6 +25,7 @@ clean:
install: install:
-mkdir -p $(BINDIR) -mkdir -p $(BINDIR)
cp $(BIN) a2mount $(BINDIR) cp $(BIN) a2mount $(BINDIR)
cp $(BIN) a2setvd $(BINDIR)
-mkdir -p $(SBINDIR) -mkdir -p $(SBINDIR)
cp $(SBIN) $(SBINDIR) cp $(SBIN) $(SBINDIR)
-mkdir -p $(SHAREDIR) -mkdir -p $(SHAREDIR)

View File

@ -14,8 +14,8 @@ int a2open(char *ipaddr)
int fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); int fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (fd < 0) if (fd < 0)
{ {
perror("Cannot create socket"); perror("Cannot create socket");
return -1; return -1;
} }
memset(&piaddr, 0, sizeof(piaddr)); memset(&piaddr, 0, sizeof(piaddr));
piaddr.sin_family = AF_INET; piaddr.sin_family = AF_INET;
@ -23,21 +23,21 @@ int a2open(char *ipaddr)
res = inet_pton(AF_INET, ipaddr, &piaddr.sin_addr); res = inet_pton(AF_INET, ipaddr, &piaddr.sin_addr);
if (res < 0) if (res < 0)
{ {
perror("First parameter is not a valid address family"); perror("First parameter is not a valid address family");
close(fd); close(fd);
return -1; return -1;
} }
else if (res == 0) else if (res == 0)
{ {
perror("Char string (second parameter does not contain valid ipaddress)"); perror("Char string (second parameter does not contain valid ipaddress)");
close(fd); close(fd);
return -1; return -1;
} }
if (connect(fd, (struct sockaddr *)&piaddr, sizeof(piaddr)) < 0) if (connect(fd, (struct sockaddr *)&piaddr, sizeof(piaddr)) < 0)
{ {
perror("Connect failed"); perror("Connect failed");
close(fd); close(fd);
return -1; return -1;
} }
return fd; return fd;
} }
@ -84,7 +84,7 @@ int a2call(int fd, int address, int *result)
write(fd, callpkt, 3); write(fd, callpkt, 3);
read(fd, callpkt, 2); read(fd, callpkt, 2);
if (result) if (result)
*result = (unsigned char)callpkt[1]; *result = (unsigned char)callpkt[1];
return ((unsigned char)callpkt[0] == 0x9E); return ((unsigned char)callpkt[0] == 0x9E);
} }
int a2quickcall(int fd, int address, int *result) int a2quickcall(int fd, int address, int *result)
@ -96,6 +96,6 @@ int a2quickcall(int fd, int address, int *result)
write(fd, callpkt, 3); write(fd, callpkt, 3);
read(fd, callpkt, 2); read(fd, callpkt, 2);
if (result) if (result)
*result = (unsigned char)callpkt[1]; *result = (unsigned char)callpkt[1];
return ((unsigned char)callpkt[0] == 0x9E); return ((unsigned char)callpkt[0] == 0x9E);
} }

File diff suppressed because it is too large Load Diff

22
src/a2pidcmd.c Executable file
View File

@ -0,0 +1,22 @@
#include "a2lib.c"
int main(int argc, char **argv)
{
unsigned char cmd, ack;
int pifd = a2open(argc > 3 ? argv[3] : "127.0.0.1");
if (pifd < 0)
{
perror("Unable to connect to Apple II Pi");
exit(EXIT_FAILURE);
}
if (argc < 2)
{
perror("Usage: a2picmd <cmd>\n");
exit(EXIT_FAILURE);
}
cmd = (int)strtol(argv[1], NULL, 0); /* treat command as value */
write(pifd, &cmd, 1);
read(pifd, &ack, 1);
a2close(pifd);
return ack == (cmd + 1);
}

6
src/a2setvd Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
a2pidcmd 0xC2
rm /usr/share/a2pi/A2VD$1.PO
ln -s $2 /usr/share/a2pi/A2VD$1.PO
a2pidcmd 0xC0

View File

@ -1036,7 +1036,7 @@ static int a2pi_mkdir(const char *path, mode_t mode)
return -EACCES; return -EACCES;
A2PI_WAIT; A2PI_WAIT;
cachepath[0] = '\0'; cachepath[0] = '\0';
err = prodos_map_errno(prodos_create(prodos_path(path, NULL, NULL, NULL), 0xE3, 0x0F, 0, 0)); err = prodos_map_errno(prodos_create(prodos_path(path, NULL, NULL, NULL), 0xC3, 0x0F, 0, 0));
A2PI_RELEASE; A2PI_RELEASE;
return err; return err;
} }