Tidied up error message prefixes.

This commit is contained in:
Daniel Beer 2010-01-12 21:51:06 +13:00
parent f8a9b9f5b6
commit 8bcccc783f
3 changed files with 15 additions and 15 deletions

14
fet.c
View File

@ -283,7 +283,7 @@ static int parse_packet(int plen)
int error; int error;
if (c != r) { if (c != r) {
fprintf(stderr, "parse_packet: checksum error (calc %04x," fprintf(stderr, "fet: checksum error (calc %04x,"
" recv %04x)\n", c, r); " recv %04x)\n", c, r);
return -1; return -1;
} }
@ -297,7 +297,7 @@ static int parse_packet(int plen)
error = fet_buf[i++]; error = fet_buf[i++];
if (error) { if (error) {
fprintf(stderr, "parse_packet: FET returned error code %d\n", fprintf(stderr, "fet: FET returned error code %d\n",
error); error);
if (error > 0 && error < ARRAY_LEN(error_strings)) { if (error > 0 && error < ARRAY_LEN(error_strings)) {
fprintf(stderr, " (%s)\n", error_strings[error]); fprintf(stderr, " (%s)\n", error_strings[error]);
@ -316,7 +316,7 @@ static int parse_packet(int plen)
i += 2; i += 2;
if (fet_reply.argc >= MAX_PARAMS) { if (fet_reply.argc >= MAX_PARAMS) {
fprintf(stderr, "parse_packet: too many params: %d\n", fprintf(stderr, "fet: too many params: %d\n",
fet_reply.argc); fet_reply.argc);
return -1; return -1;
} }
@ -351,7 +351,7 @@ static int parse_packet(int plen)
return 0; return 0;
too_short: too_short:
fprintf(stderr, "parse_packet: too short (%d bytes)\n", fprintf(stderr, "fet: too short (%d bytes)\n",
plen); plen);
return -1; return -1;
} }
@ -492,7 +492,7 @@ static int xfer(int command_code, const u_int8_t *data, int datalen,
return -1; return -1;
if (fet_reply.command_code != command_code) { if (fet_reply.command_code != command_code) {
fprintf(stderr, "xfer: reply type mismatch\n"); fprintf(stderr, "fet: reply type mismatch\n");
return -1; return -1;
} }
@ -713,13 +713,13 @@ int fet_readmem(u_int16_t addr, u_int8_t *buffer, int count)
int plen = count > 128 ? 128 : count; int plen = count > 128 ? 128 : count;
if (xfer(C_READMEMORY, NULL, 0, 2, addr, plen) < 0) { if (xfer(C_READMEMORY, NULL, 0, 2, addr, plen) < 0) {
fprintf(stderr, "fet_read_mem: failed to read " fprintf(stderr, "fet: failed to read "
"from 0x%04x\n", addr); "from 0x%04x\n", addr);
return -1; return -1;
} }
if (fet_reply.datalen < plen) { if (fet_reply.datalen < plen) {
fprintf(stderr, "fet_read_mem: short data: " fprintf(stderr, "fet: short data: "
"%d bytes\n", fet_reply.datalen); "%d bytes\n", fet_reply.datalen);
return -1; return -1;
} }

4
main.c
View File

@ -570,7 +570,7 @@ static int cmd_eval(char **arg)
const char *name; const char *name;
if (stab_parse(*arg, &addr) < 0) { if (stab_parse(*arg, &addr) < 0) {
fprintf(stderr, "eval: can't parse: %s\n", *arg); fprintf(stderr, "=: can't parse: %s\n", *arg);
return -1; return -1;
} }
@ -601,7 +601,7 @@ static int cmd_syms(char **arg)
if (elf32_check(in)) if (elf32_check(in))
result = elf32_syms(in); result = elf32_syms(in);
else else
fprintf(stderr, "%s: unknown file type\n", *arg); fprintf(stderr, "syms: %s: unknown file type\n", *arg);
fclose(in); fclose(in);
return result; return result;

View File

@ -52,16 +52,16 @@ static int usbtr_open_interface(struct usb_device *dev, int ino)
usbtr_handle = usb_open(dev); usbtr_handle = usb_open(dev);
if (!usbtr_handle) { if (!usbtr_handle) {
perror("usbtr_open_interface: can't open device"); perror("rf2500: can't open device");
return -1; return -1;
} }
if (usb_detach_kernel_driver_np(usbtr_handle, usbtr_int_number) < 0) if (usb_detach_kernel_driver_np(usbtr_handle, usbtr_int_number) < 0)
perror("usbtr_open_interface: warning: can't " perror("rf2500: warning: can't "
"detach kernel driver"); "detach kernel driver");
if (usb_claim_interface(usbtr_handle, usbtr_int_number) < 0) { if (usb_claim_interface(usbtr_handle, usbtr_int_number) < 0) {
perror("usbtr_open_interface: can't claim interface"); perror("rf2500: can't claim interface");
usb_close(usbtr_handle); usb_close(usbtr_handle);
return -1; return -1;
} }
@ -112,7 +112,7 @@ static int usbtr_send(const u_int8_t *data, int len)
#endif #endif
if (usb_bulk_write(usbtr_handle, USB_FET_OUT_EP, if (usb_bulk_write(usbtr_handle, USB_FET_OUT_EP,
(const char *)pbuf, txlen, 10000) < 0) { (const char *)pbuf, txlen, 10000) < 0) {
perror("usbtr_send"); perror("rf2500: can't send data");
return -1; return -1;
} }
@ -145,7 +145,7 @@ static int usbtr_recv(u_int8_t *databuf, int max_len)
if (usb_bulk_read(usbtr_handle, USB_FET_IN_EP, if (usb_bulk_read(usbtr_handle, USB_FET_IN_EP,
(char *)usbtr_buf, sizeof(usbtr_buf), (char *)usbtr_buf, sizeof(usbtr_buf),
10000) < 0) { 10000) < 0) {
perror("usbtr_recv"); perror("rf2500: can't receive data");
return -1; return -1;
} }
@ -203,6 +203,6 @@ const struct fet_transport *rf2500_open(void)
} }
} }
fprintf(stderr, "usbtr_open: no devices could be found\n"); fprintf(stderr, "rf2500: no devices could be found\n");
return NULL; return NULL;
} }