CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: christos Date: Sat Oct 19 17:06:57 UTC 2013 Modified Files: src/usr.sbin/fwctl: fwdv.c Log Message: move all the code that is unused inside #if 0 To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/fwctl/fwdv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/fwdv.c diff -u src/usr.sbin/fwctl/fwdv.c:1.7 src/usr.sbin/fwctl/fwdv.c:1.8 --- src/usr.sbin/fwctl/fwdv.c:1.7 Sun Feb 6 20:37:12 2011 +++ src/usr.sbin/fwctl/fwdv.c Sat Oct 19 13:06:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: fwdv.c,v 1.7 2011/02/07 01:37:12 dholland Exp $ */ +/* $NetBSD: fwdv.c,v 1.8 2013/10/19 17:06:57 christos Exp $ */ /* * Copyright (C) 2003 * Hidetoshi Shimokawa. All rights reserved. @@ -265,7 +265,7 @@ dvsend(int d, const char *filename, char struct dvdbc *dv; struct fw_pkt *pkt; int len, tlen, header, fd, frames, packets, vec, offset, nhdr, i; - int lsystem=-1, pad_acc, cycle_acc, cycle, f_cycle, f_frac; + int lsystem=-1, pad_acc, cycle_acc, cycle, f_frac; struct iovec wbuf[TNBUF*2 + NEMPTY]; char *pbuf; uint32_t iso_data, iso_empty, hdr[TNBUF + NEMPTY][3]; @@ -368,10 +368,11 @@ next: if (frames % frame_rate[lsystem] == 0) fprintf(stderr, \n); fflush(stderr); - f_cycle = (cycle_acc / frame_cycle[lsystem].d) 0xf; f_frac = (cycle_acc % frame_cycle[lsystem].d * CYCLE_FRAC) / frame_cycle[lsystem].d; #if 0 + int f_cycle = (cycle_acc / frame_cycle[lsystem].d) + 0xf; ciph-fdf.dv.cyc = htons(f_cycle 12 | f_frac); #else ciph-fdf.dv.cyc = htons(cycle 12 | f_frac);
CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: mbalmer Date: Mon Oct 17 16:50:47 UTC 2011 Modified Files: src/usr.sbin/fwctl: fwcontrol.c Log Message: Revieve - Receive in a comment. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/fwctl/fwcontrol.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/fwcontrol.c diff -u src/usr.sbin/fwctl/fwcontrol.c:1.15 src/usr.sbin/fwctl/fwcontrol.c:1.16 --- src/usr.sbin/fwctl/fwcontrol.c:1.15 Wed Aug 31 13:32:36 2011 +++ src/usr.sbin/fwctl/fwcontrol.c Mon Oct 17 16:50:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fwcontrol.c,v 1.15 2011/08/31 13:32:36 joerg Exp $ */ +/* $NetBSD: fwcontrol.c,v 1.16 2011/10/17 16:50:47 mbalmer Exp $ */ /* * Copyright (C) 2002 * Hidetoshi Shimokawa. All rights reserved. @@ -34,7 +34,7 @@ */ #include sys/cdefs.h //__FBSDID($FreeBSD: src/usr.sbin/fwcontrol/fwcontrol.c,v 1.23 2006/10/26 22:33:38 imp Exp $); -__RCSID($NetBSD: fwcontrol.c,v 1.15 2011/08/31 13:32:36 joerg Exp $); +__RCSID($NetBSD: fwcontrol.c,v 1.16 2011/10/17 16:50:47 mbalmer Exp $); #include sys/param.h #include sys/malloc.h @@ -1058,7 +1058,7 @@ main(int argc, char **argv) show_topology_map(fd); /* - * Recieve data file from node -R + * Receive data file from node -R */ #define TAG (16) #define CHANNEL 63
CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: christos Date: Sun Aug 14 17:42:23 UTC 2011 Modified Files: src/usr.sbin/fwctl: Makefile fwcontrol.c Log Message: use memcpy to avoid type punned warnings To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/fwctl/Makefile cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/fwctl/fwcontrol.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/Makefile diff -u src/usr.sbin/fwctl/Makefile:1.5 src/usr.sbin/fwctl/Makefile:1.6 --- src/usr.sbin/fwctl/Makefile:1.5 Tue Jun 21 22:49:45 2011 +++ src/usr.sbin/fwctl/Makefile Sun Aug 14 13:42:23 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.5 2011/06/22 02:49:45 mrg Exp $ +# $NetBSD: Makefile,v 1.6 2011/08/14 17:42:23 christos Exp $ WARNS?=5 PROG= fwctl @@ -11,8 +11,3 @@ CPPFLAGS+=-I${.CURDIR} -I${SDIR} .include bsd.prog.mk - -# XXX -.if ${HAVE_GCC} == 45 -COPTS.fwcontrol.c+= -fno-strict-aliasing -.endif Index: src/usr.sbin/fwctl/fwcontrol.c diff -u src/usr.sbin/fwctl/fwcontrol.c:1.13 src/usr.sbin/fwctl/fwcontrol.c:1.14 --- src/usr.sbin/fwctl/fwcontrol.c:1.13 Tue Jan 4 15:45:13 2011 +++ src/usr.sbin/fwctl/fwcontrol.c Sun Aug 14 13:42:23 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fwcontrol.c,v 1.13 2011/01/04 20:45:13 christos Exp $ */ +/* $NetBSD: fwcontrol.c,v 1.14 2011/08/14 17:42:23 christos Exp $ */ /* * Copyright (C) 2002 * Hidetoshi Shimokawa. All rights reserved. @@ -34,7 +34,7 @@ */ #include sys/cdefs.h //__FBSDID($FreeBSD: src/usr.sbin/fwcontrol/fwcontrol.c,v 1.23 2006/10/26 22:33:38 imp Exp $); -__RCSID($NetBSD: fwcontrol.c,v 1.13 2011/01/04 20:45:13 christos Exp $); +__RCSID($NetBSD: fwcontrol.c,v 1.14 2011/08/14 17:42:23 christos Exp $); #include sys/param.h #include sys/malloc.h @@ -91,8 +91,11 @@ static void fweui2eui64(const struct fw_eui64 *fweui, struct eui64 *eui) { - *(uint32_t*)(eui-octet[0]) = htonl(fweui-hi); - *(uint32_t*)(eui-octet[4]) = htonl(fweui-lo); + uint32_t hi, lo; + hi = htonl(fweui-hi); + lo = htonl(fweui-lo); + memcpy(eui-octet[0], hi, sizeof(hi)); + memcpy(eui-octet[4], lo, sizeof(lo)); } static void @@ -1027,8 +1030,11 @@ * Set the fwmem target for a node to argument -m */ if (set_fwmem_target) { - eui.hi = ntohl(*(uint32_t*)(target.octet[0])); - eui.lo = ntohl(*(uint32_t*)(target.octet[4])); + uint32_t hi, lo; + memcpy(hi, target.octet[0], sizeof(hi)); + memcpy(lo, target.octet[4], sizeof(lo)); + eui.hi = ntohl(hi); + eui.lo = ntohl(lo); sysctl_set_int(hw.fwmem.eui64_hi, eui.hi); sysctl_set_int(hw.fwmem.eui64_lo, eui.lo); }
CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: dholland Date: Mon Feb 7 01:37:12 UTC 2011 Modified Files: src/usr.sbin/fwctl: fwdv.c Log Message: Fix typo, from Henning Petersen in PR 44513. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/fwctl/fwdv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/fwdv.c diff -u src/usr.sbin/fwctl/fwdv.c:1.6 src/usr.sbin/fwctl/fwdv.c:1.7 --- src/usr.sbin/fwctl/fwdv.c:1.6 Tue Jan 4 20:45:13 2011 +++ src/usr.sbin/fwctl/fwdv.c Mon Feb 7 01:37:12 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fwdv.c,v 1.6 2011/01/04 20:45:13 christos Exp $ */ +/* $NetBSD: fwdv.c,v 1.7 2011/02/07 01:37:12 dholland Exp $ */ /* * Copyright (C) 2003 * Hidetoshi Shimokawa. All rights reserved. @@ -149,7 +149,7 @@ continue; } else err(EXIT_FAILURE, %s: read failed, - __fnc__); + __func__); } tlen += len; if ((RBUFSIZE - tlen) PSIZE)
CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: wiz Date: Tue Jan 4 09:04:24 UTC 2011 Modified Files: src/usr.sbin/fwctl: fwdv.c fwmpegts.c Log Message: Use format string for err(). From Henning Petersen in PR 44326. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/fwctl/fwdv.c cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/fwctl/fwmpegts.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/fwdv.c diff -u src/usr.sbin/fwctl/fwdv.c:1.4 src/usr.sbin/fwctl/fwdv.c:1.5 --- src/usr.sbin/fwctl/fwdv.c:1.4 Tue Aug 24 08:41:24 2010 +++ src/usr.sbin/fwctl/fwdv.c Tue Jan 4 09:04:24 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fwdv.c,v 1.4 2010/08/24 08:41:24 cegger Exp $ */ +/* $NetBSD: fwdv.c,v 1.5 2011/01/04 09:04:24 wiz Exp $ */ /* * Copyright (C) 2003 * Hidetoshi Shimokawa. All rights reserved. @@ -107,7 +107,7 @@ } else { fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0660); if (fd == -1) - err(EX_NOINPUT, filename); + err(EX_NOINPUT, %s, filename); } buf = malloc(RBUFSIZE); pad = malloc(DSIZE*MAXBLOCKS); @@ -269,7 +269,7 @@ fd = open(filename, O_RDONLY); if (fd == -1) - err(EX_NOINPUT, filename); + err(EX_NOINPUT, %s, filename); pbuf = malloc(DSIZE * TNBUF); bzero(wbuf, sizeof(wbuf)); Index: src/usr.sbin/fwctl/fwmpegts.c diff -u src/usr.sbin/fwctl/fwmpegts.c:1.2 src/usr.sbin/fwctl/fwmpegts.c:1.3 --- src/usr.sbin/fwctl/fwmpegts.c:1.2 Tue Aug 24 08:41:24 2010 +++ src/usr.sbin/fwctl/fwmpegts.c Tue Jan 4 09:04:24 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fwmpegts.c,v 1.2 2010/08/24 08:41:24 cegger Exp $ */ +/* $NetBSD: fwmpegts.c,v 1.3 2011/01/04 09:04:24 wiz Exp $ */ /* * Copyright (C) 2005 * Petr Holub, Hidetoshi Shimokawa. All rights reserved. @@ -156,7 +156,7 @@ else { fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0660); if (fd == -1) - err(EX_NOINPUT, filename); + err(EX_NOINPUT, %s, filename); } buf = malloc(RBUFSIZE);
CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: cegger Date: Mon Dec 13 11:51:23 UTC 2010 Modified Files: src/usr.sbin/fwctl: fwcontrol.c Log Message: PR bin/44230: Missing close. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/fwctl/fwcontrol.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/fwcontrol.c diff -u src/usr.sbin/fwctl/fwcontrol.c:1.10 src/usr.sbin/fwctl/fwcontrol.c:1.11 --- src/usr.sbin/fwctl/fwcontrol.c:1.10 Thu Aug 26 07:04:04 2010 +++ src/usr.sbin/fwctl/fwcontrol.c Mon Dec 13 11:51:23 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: fwcontrol.c,v 1.10 2010/08/26 07:04:04 cegger Exp $ */ +/* $NetBSD: fwcontrol.c,v 1.11 2010/12/13 11:51:23 cegger Exp $ */ /* * Copyright (C) 2002 * Hidetoshi Shimokawa. All rights reserved. @@ -34,7 +34,7 @@ */ #include sys/cdefs.h //__FBSDID($FreeBSD: src/usr.sbin/fwcontrol/fwcontrol.c,v 1.23 2006/10/26 22:33:38 imp Exp $); -__RCSID($NetBSD: fwcontrol.c,v 1.10 2010/08/26 07:04:04 cegger Exp $); +__RCSID($NetBSD: fwcontrol.c,v 1.11 2010/12/13 11:51:23 cegger Exp $); #include sys/param.h #include sys/malloc.h @@ -492,6 +492,7 @@ fscanf(file, DUMP_FORMAT, p, p+1, p+2, p+3, p+4, p+5, p+6, p+7); p += 8; } + fclose(file); } static void
CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: christos Date: Mon Dec 13 16:52:53 UTC 2010 Modified Files: src/usr.sbin/fwctl: fwcontrol.c Log Message: - no casts for malloc and free - malloc(type) - malloc(*value) - malloc+strcpy - strdup To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/fwctl/fwcontrol.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/fwcontrol.c diff -u src/usr.sbin/fwctl/fwcontrol.c:1.11 src/usr.sbin/fwctl/fwcontrol.c:1.12 --- src/usr.sbin/fwctl/fwcontrol.c:1.11 Mon Dec 13 06:51:23 2010 +++ src/usr.sbin/fwctl/fwcontrol.c Mon Dec 13 11:52:53 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: fwcontrol.c,v 1.11 2010/12/13 11:51:23 cegger Exp $ */ +/* $NetBSD: fwcontrol.c,v 1.12 2010/12/13 16:52:53 christos Exp $ */ /* * Copyright (C) 2002 * Hidetoshi Shimokawa. All rights reserved. @@ -34,7 +34,7 @@ */ #include sys/cdefs.h //__FBSDID($FreeBSD: src/usr.sbin/fwcontrol/fwcontrol.c,v 1.23 2006/10/26 22:33:38 imp Exp $); -__RCSID($NetBSD: fwcontrol.c,v 1.11 2010/12/13 11:51:23 cegger Exp $); +__RCSID($NetBSD: fwcontrol.c,v 1.12 2010/12/13 16:52:53 christos Exp $); #include sys/param.h #include sys/malloc.h @@ -111,7 +111,8 @@ struct eui64 eui, tmpeui; struct fw_devlstreq *data; char *endptr; - int i, node; + int i; + long node; if (nodestr == '\0') return -1; @@ -129,7 +130,7 @@ if (eui64_hostton(nodestr, eui) != 0 eui64_aton(nodestr, eui) != 0) return -1; - data = (struct fw_devlstreq *)malloc(sizeof(struct fw_devlstreq)); + data = malloc(sizeof(*data)); if (data == NULL) err(EX_SOFTWARE, %s: data malloc, __func__); get_dev(fd,data); @@ -153,7 +154,7 @@ if (node 0 || node 63) return -1; else - return node; + return (int)node; } static void @@ -165,7 +166,7 @@ char addr[EUI64_SIZ], hostname[40]; int i; - data = (struct fw_devlstreq *)malloc(sizeof(struct fw_devlstreq)); + data = malloc(sizeof(*data)); if (data == NULL) err(EX_SOFTWARE, %s:data malloc, __func__); get_dev(fd, data); @@ -178,10 +179,10 @@ if (eui64_ntohost(hostname, sizeof(hostname), eui)) hostname[0] = 0; printf(%4d %s %6d%s\n, - (devinfo-status || i == 0) ? devinfo-dst : -1, - addr, devinfo-status, hostname); + (devinfo-status || i == 0) ? devinfo-dst : -1, + addr, devinfo-status, hostname); } - free((void *)data); + free(data); } static uint32_t @@ -191,7 +192,7 @@ struct fw_asyreq *asyreq; uint32_t *qld, res; - asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 16); + asyreq = malloc(sizeof(struct fw_asyreq_t) + 16); if (asyreq == NULL) err(EX_SOFTWARE, %s:asyreq malloc, __func__); asyreq-req.len = 16; @@ -245,7 +246,7 @@ { struct fw_asyreq *asyreq; - asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 12); + asyreq = malloc(sizeof(struct fw_asyreq_t) + 12); if (asyreq == NULL) err(EX_SOFTWARE, %s:asyreq malloc, __func__); asyreq-req.len = 12; @@ -272,7 +273,7 @@ { struct fw_asyreq *asyreq; - asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 12); + asyreq = malloc(sizeof(struct fw_asyreq_t) + 12); if (asyreq == NULL) err(EX_SOFTWARE, %s:asyreq malloc, __func__); asyreq-req.len = 12; @@ -291,7 +292,7 @@ { struct fw_asyreq *asyreq; - asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 16); + asyreq = malloc(sizeof(struct fw_asyreq_t) + 16); if (asyreq == NULL) err(EX_SOFTWARE, %s:asyreq malloc, __func__); asyreq-req.len = 16; @@ -320,7 +321,7 @@ uint32_t max, reg, old; int i; - data = (struct fw_devlstreq *)malloc(sizeof(struct fw_devlstreq)); + data = malloc(sizeof(*data)); if (data == NULL) err(EX_SOFTWARE, %s:data malloc, __func__); get_dev(fd, data); @@ -345,7 +346,7 @@ printf(\n); } } - free((void *)data); + free(data); } static void @@ -377,7 +378,7 @@ int i, error; struct fw_devlstreq *data; - data = (struct fw_devlstreq *)malloc(sizeof(struct fw_devlstreq)); + data = malloc(sizeof(*data)); if (data == NULL) err(EX_SOFTWARE, %s:data malloc, __func__); get_dev(fd, data); @@ -492,7 +493,7 @@ fscanf(file, DUMP_FORMAT, p, p+1, p+2, p+3, p+4, p+5, p+6, p+7); p += 8; } - fclose(file); + (void)fclose(file); } static void @@ -506,7 +507,7 @@ -1W, -2W, -5W, -9W}; static const char *speed[] = {S100, S200, S400, S800}; - tmap = malloc(sizeof(struct fw_topology_map)); + tmap = malloc(sizeof(*tmap)); if (tmap == NULL) err(EX_SOFTWARE, %s:tmap malloc, __func__); if (ioctl(fd, FW_GTPMAP, tmap) 0) @@ -675,7 +676,7 @@ if (ioctl(fd, FW_SRSTREAM, isoreq) 0) err(EX_IOERR, %s: ioctl FW_SRSTREAM, __func__); - buf = (char *)malloc(RECV_NUM_PACKET * RECV_PACKET_SZ); + buf = malloc(RECV_NUM_PACKET * RECV_PACKET_SZ); if (buf == NULL) err(EX_SOFTWARE, %s:buf malloc, __func__); /* @@ -787,7 +788,7 @@
CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: cegger Date: Thu Aug 26 07:04:05 UTC 2010 Modified Files: src/usr.sbin/fwctl: fwcontrol.c Log Message: show crom: Print calculated crc. When crc does not match then print expected crc. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/fwctl/fwcontrol.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/fwcontrol.c diff -u src/usr.sbin/fwctl/fwcontrol.c:1.9 src/usr.sbin/fwctl/fwcontrol.c:1.10 --- src/usr.sbin/fwctl/fwcontrol.c:1.9 Tue Aug 24 08:41:24 2010 +++ src/usr.sbin/fwctl/fwcontrol.c Thu Aug 26 07:04:04 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: fwcontrol.c,v 1.9 2010/08/24 08:41:24 cegger Exp $ */ +/* $NetBSD: fwcontrol.c,v 1.10 2010/08/26 07:04:04 cegger Exp $ */ /* * Copyright (C) 2002 * Hidetoshi Shimokawa. All rights reserved. @@ -34,7 +34,7 @@ */ #include sys/cdefs.h //__FBSDID($FreeBSD: src/usr.sbin/fwcontrol/fwcontrol.c,v 1.23 2006/10/26 22:33:38 imp Exp $); -__RCSID($NetBSD: fwcontrol.c,v 1.9 2010/08/24 08:41:24 cegger Exp $); +__RCSID($NetBSD: fwcontrol.c,v 1.10 2010/08/26 07:04:04 cegger Exp $); #include sys/param.h #include sys/malloc.h @@ -401,6 +401,15 @@ } static void +show_crc(uint16_t crc, uint16_t good_crc) +{ + if (crc == good_crc) + printf((OK)\n); + else + printf((NG, 0x%x)\n, good_crc); +} + +static void show_crom(uint32_t *crom_buf) { int i; @@ -422,16 +431,13 @@ if (hdr-info_len == 1) { /* minimum ROM */ reg = (struct csrreg *)hdr; - printf(verndor ID: 0x%06x\n, reg-val); + printf(vendor ID: 0x%06x\n, reg-val); return; } - printf(info_len=%d crc_len=%d crc=0x%04x, - hdr-info_len, hdr-crc_len, hdr-crc); crc = crom_crc(crom_buf+1, hdr-crc_len); - if (crc == hdr-crc) - printf((OK)\n); - else - printf((NG)\n); + printf(info_len=%d crc_len=%d crc=0x%04x , + hdr-info_len, hdr-crc_len, crc); + show_crc(crc, hdr-crc); parse_bus_info_block(crom_buf+1); crom_init_context(cc, crom_buf); @@ -440,13 +446,10 @@ printf(no root directory - giving up\n); return; } - printf(root_directory: len=0x%04x(%d) crc=0x%04x, - dir-crc_len, dir-crc_len, dir-crc); crc = crom_crc((uint32_t *)dir-entry[0], dir-crc_len); - if (crc == dir-crc) - printf((OK)\n); - else - printf((NG)\n); + printf(root_directory: len=0x%04x(%d) crc=0x%04x , + dir-crc_len, dir-crc_len, crc); + show_crc(crc, dir-crc); if (dir-crc_len 1) return; while (cc.depth = 0) {
CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: cegger Date: Tue Aug 24 08:41:24 UTC 2010 Modified Files: src/usr.sbin/fwctl: fwcontrol.c fwctl.8 fwdv.c fwmpegts.c Log Message: Backport improvements from FreeBSD. Introduce two new options: -f : force root node -i : set priority budget where supported developped, tested and reviewed by kiyohara@ and me. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/fwctl/fwcontrol.c cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/fwctl/fwctl.8 cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/fwctl/fwdv.c cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/fwctl/fwmpegts.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/fwcontrol.c diff -u src/usr.sbin/fwctl/fwcontrol.c:1.8 src/usr.sbin/fwctl/fwcontrol.c:1.9 --- src/usr.sbin/fwctl/fwcontrol.c:1.8 Mon Mar 29 10:49:34 2010 +++ src/usr.sbin/fwctl/fwcontrol.c Tue Aug 24 08:41:24 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: fwcontrol.c,v 1.8 2010/03/29 10:49:34 cegger Exp $ */ +/* $NetBSD: fwcontrol.c,v 1.9 2010/08/24 08:41:24 cegger Exp $ */ /* * Copyright (C) 2002 * Hidetoshi Shimokawa. All rights reserved. @@ -32,11 +32,9 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#if defined(__FreeBSD__) - #include sys/cdefs.h -__FBSDID($FreeBSD: src/usr.sbin/fwcontrol/fwcontrol.c,v 1.23 2006/10/26 22:33:38 imp Exp $); -#endif +//__FBSDID($FreeBSD: src/usr.sbin/fwcontrol/fwcontrol.c,v 1.23 2006/10/26 22:33:38 imp Exp $); +__RCSID($NetBSD: fwcontrol.c,v 1.9 2010/08/24 08:41:24 cegger Exp $); #include sys/param.h #include sys/malloc.h @@ -45,19 +43,11 @@ #include sys/socket.h #include sys/ioctl.h #include sys/errno.h -#if defined(__FreeBSD__) -#include sys/eui64.h -#include dev/firewire/firewire.h -#include dev/firewire/iec13213.h -#include dev/firewire/fwphyreg.h -#include dev/firewire/iec68113.h -#elif defined(__NetBSD__) #include eui64.h #include dev/ieee1394/firewire.h #include dev/ieee1394/iec13213.h #include dev/ieee1394/fwphyreg.h #include dev/ieee1394/iec68113.h -#endif #include netinet/in.h #include fcntl.h @@ -75,47 +65,44 @@ usage(void) { fprintf(stderr, - %s [-prt] [-b pri_req] [-c node] [-d node] - [-g gap_count] [-l file]\n - \t[-m EUI64 | hostname] [-o node] [-R filename] - [-S filename]\n - \t[-s node] [-u bus_num]\n - \t-b: set PRIORITY_BUDGET register on all supported nodes\n - \t-c: read configuration ROM\n - \t-d: hex dump of configuration ROM\n - \t-g: broadcast gap_count by phy_config packet\n - \t-l: load and parse hex dump file of configuration ROM\n - \t-m: set fwmem target\n - \t-o: send link-on packet to the node\n - \t-p: dump PHY registers\n - \t-R: receive DV or MPEG TS stream\n - \t-r: bus reset\n - \t-S: send DV stream\n - \t-s: write RESET_START register on the node\n - \t-t: read topology map\n - \t-u: specify bus number\n, getprogname()); + %s [-prt] [-b pri_req] [-c node] [-d node] [-f force_root ]\n + \t[-g gap_count] [-l file] [-M mode] [-m EUI64 | hostname]\n + \t[-o node] [-R filename] [-S filename] [-s node] [-u bus_num]\n + \n + \t-b: set PRIORITY_BUDGET register on all supported nodes\n + \t-c: read configuration ROM\n + \t-d: hex dump of configuration ROM\n + \t-f: force root node\n + \t-g: broadcast gap_count by phy_config packet\n + \t-l: load and parse hex dump file of configuration ROM\n + \t-M: specify dv or mpeg\n + \t-m: set fwmem target\n + \t-o: send link-on packet to the node\n + \t-p: dump PHY registers\n + \t-R: receive DV or MPEG TS stream\n + \t-r: bus reset\n + \t-S: send DV stream\n + \t-s: write RESET_START register on the node\n + \t-t: read topology map\n + \t-u: specify bus number\n, getprogname()); exit(EX_USAGE); } static void fweui2eui64(const struct fw_eui64 *fweui, struct eui64 *eui) { - *(u_int32_t*)(eui-octet[0]) = htonl(fweui-hi); - *(u_int32_t*)(eui-octet[4]) = htonl(fweui-lo); + *(uint32_t*)(eui-octet[0]) = htonl(fweui-hi); + *(uint32_t*)(eui-octet[4]) = htonl(fweui-lo); } -static struct fw_devlstreq * -get_dev(int fd) +static void +get_dev(int fd, struct fw_devlstreq *data) { - struct fw_devlstreq *data; - data = malloc(sizeof(*data)); if (data == NULL) - err(1, malloc); - if( ioctl(fd, FW_GDEVLST, data) 0) { - err(1, ioctl); - } - return data; + err(EX_SOFTWARE, %s: data malloc, __func__); + if (ioctl(fd, FW_GDEVLST, data) 0) + err(EX_IOERR, %s: ioctl, __func__); } static int @@ -127,7 +114,7 @@ int i, node; if (nodestr == '\0') - return (-1); + return -1; /* * Deal with classic node specifications. @@ -140,25 +127,33 @@ * Try to get an eui and match it against available nodes. */ if (eui64_hostton(nodestr, eui) != 0 eui64_aton(nodestr, eui) != 0) - return (-1); + return -1; - data = get_dev(fd); + data = (struct fw_devlstreq
CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: wiz Date: Mon Aug 16 06:56:48 UTC 2010 Modified Files: src/usr.sbin/fwctl: fwctl.8 Log Message: Revert unimprovement from previous. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/fwctl/fwctl.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/fwctl.8 diff -u src/usr.sbin/fwctl/fwctl.8:1.13 src/usr.sbin/fwctl/fwctl.8:1.14 --- src/usr.sbin/fwctl/fwctl.8:1.13 Sun Aug 15 22:05:14 2010 +++ src/usr.sbin/fwctl/fwctl.8 Mon Aug 16 06:56:48 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: fwctl.8,v 1.13 2010/08/15 22:05:14 cegger Exp $ +.\ $NetBSD: fwctl.8,v 1.14 2010/08/16 06:56:48 wiz Exp $ .\ .\ Copyright (c) 2005 KIYOHARA Takashi .\ All rights reserved. @@ -102,8 +102,8 @@ .It Fl p Dump PHY registers. .It Fl R Ar filename -Recieve DV or MPEG TS stream and dump it to a file. -Use Ctrl-C to stop recieving. +Receive DV or MPEG TS stream and dump it to a file. +Use Ctrl-C to stop receiving. Some DV cameras seem not to send the stream if a bus manager exits. If you cannot get the stream, try the following commands: .Bd -literal -offset indent
CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: cegger Date: Sun Aug 15 21:52:30 UTC 2010 Modified Files: src/usr.sbin/fwctl: fwctl.8 Log Message: Feed improvements from FreeBSD To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/fwctl/fwctl.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/fwctl.8 diff -u src/usr.sbin/fwctl/fwctl.8:1.10 src/usr.sbin/fwctl/fwctl.8:1.11 --- src/usr.sbin/fwctl/fwctl.8:1.10 Sat Aug 14 16:32:26 2010 +++ src/usr.sbin/fwctl/fwctl.8 Sun Aug 15 21:52:30 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: fwctl.8,v 1.10 2010/08/14 16:32:26 pgoyette Exp $ +.\ $NetBSD: fwctl.8,v 1.11 2010/08/15 21:52:30 cegger Exp $ .\ .\ Copyright (c) 2005 KIYOHARA Takashi .\ All rights reserved. @@ -72,9 +72,11 @@ .It Fl d Ar node Hex dump of the configuration ROM. .It Fl g Ar gap_count -Broadcast +Broadcast new .Ar gap_count by phy_config packet. +By default this value is 63 on all nodes. +Valid values are 0 - 63. .It Fl l Ar file Load hex dump file of the configuration ROM and parse it. .It Fl M Ar mode @@ -87,9 +89,9 @@ .Fl R option. If not specified, the program will try to guess. -If you get an error complaining about -.Dq format 0x20 , -try to force the +In case of +.Dq format 0x20 +error, try to force the .Ar mpeg mode. .It Fl m Ar EUI64 | hostname @@ -100,8 +102,8 @@ .It Fl p Dump PHY registers. .It Fl R Ar filename -Receive DV or MPEG TS stream and dump it to a file. -Use Ctrl-C to stop receiving. +Recieve DV or MPEG TS stream and dump it to a file. +Use Ctrl-C to stop recieving. Some DV cameras seem not to send the stream if a bus manager exits. If you cannot get the stream, try the following commands: .Bd -literal -offset indent @@ -133,6 +135,7 @@ Show the topology map. .It Fl u Ar bus_num Specify the IEEE1394 bus number to be operated on. +The default is bus 0. .El .Sh FILES .Bl -tag
CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: cegger Date: Sun Aug 15 22:01:58 UTC 2010 Modified Files: src/usr.sbin/fwctl: fwctl.8 Log Message: spelling fix To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/fwctl/fwctl.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/fwctl.8 diff -u src/usr.sbin/fwctl/fwctl.8:1.11 src/usr.sbin/fwctl/fwctl.8:1.12 --- src/usr.sbin/fwctl/fwctl.8:1.11 Sun Aug 15 21:52:30 2010 +++ src/usr.sbin/fwctl/fwctl.8 Sun Aug 15 22:01:57 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: fwctl.8,v 1.11 2010/08/15 21:52:30 cegger Exp $ +.\ $NetBSD: fwctl.8,v 1.12 2010/08/15 22:01:57 cegger Exp $ .\ .\ Copyright (c) 2005 KIYOHARA Takashi .\ All rights reserved. @@ -71,12 +71,21 @@ Show the configuration ROM on the node. .It Fl d Ar node Hex dump of the configuration ROM. +.It Fl f Ar node +Force specified +.Ar node +to be the root node on the next bus reset by sending a PHY config packet. +Valid values are 0 - 63. .It Fl g Ar gap_count Broadcast new .Ar gap_count by phy_config packet. By default this value is 63 on all nodes. Valid values are 0 - 63. +.It Fl i Ar pri_req +Set the +.Dv PRIORITY_BUDGET +register on all supported nodes. .It Fl l Ar file Load hex dump file of the configuration ROM and parse it. .It Fl M Ar mode @@ -172,7 +181,7 @@ MPEG-2 stream at 25 Mbps bandwidth. .Pp To send the stream from the camera over the network using TCP (which -supprisingly works better with vlc), you can use +surprisingly works better with vlc), you can use .Dl fwctl -R - | nc 192.168.10.11 9000 with .Pa pkgsrc/net/netcat
CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: cegger Date: Sun Aug 15 22:05:14 UTC 2010 Modified Files: src/usr.sbin/fwctl: fwctl.8 Log Message: backout accidentally committed changes To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/fwctl/fwctl.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/fwctl.8 diff -u src/usr.sbin/fwctl/fwctl.8:1.12 src/usr.sbin/fwctl/fwctl.8:1.13 --- src/usr.sbin/fwctl/fwctl.8:1.12 Sun Aug 15 22:01:57 2010 +++ src/usr.sbin/fwctl/fwctl.8 Sun Aug 15 22:05:14 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: fwctl.8,v 1.12 2010/08/15 22:01:57 cegger Exp $ +.\ $NetBSD: fwctl.8,v 1.13 2010/08/15 22:05:14 cegger Exp $ .\ .\ Copyright (c) 2005 KIYOHARA Takashi .\ All rights reserved. @@ -71,21 +71,12 @@ Show the configuration ROM on the node. .It Fl d Ar node Hex dump of the configuration ROM. -.It Fl f Ar node -Force specified -.Ar node -to be the root node on the next bus reset by sending a PHY config packet. -Valid values are 0 - 63. .It Fl g Ar gap_count Broadcast new .Ar gap_count by phy_config packet. By default this value is 63 on all nodes. Valid values are 0 - 63. -.It Fl i Ar pri_req -Set the -.Dv PRIORITY_BUDGET -register on all supported nodes. .It Fl l Ar file Load hex dump file of the configuration ROM and parse it. .It Fl M Ar mode
CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: cegger Date: Sat Aug 14 16:23:49 UTC 2010 Modified Files: src/usr.sbin/fwctl: fwctl.8 Log Message: fwcontrol - fwctl To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/fwctl/fwctl.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/fwctl.8 diff -u src/usr.sbin/fwctl/fwctl.8:1.8 src/usr.sbin/fwctl/fwctl.8:1.9 --- src/usr.sbin/fwctl/fwctl.8:1.8 Mon May 18 11:57:30 2009 +++ src/usr.sbin/fwctl/fwctl.8 Sat Aug 14 16:23:49 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: fwctl.8,v 1.8 2009/05/18 11:57:30 wiz Exp $ +.\ $NetBSD: fwctl.8,v 1.9 2010/08/14 16:23:49 cegger Exp $ .\ .\ Copyright (c) 2005 KIYOHARA Takashi .\ All rights reserved. @@ -161,7 +161,7 @@ with .Dq Li bs=144000 . .Pp -.Dl fwcontrol -R file.m2t +.Dl fwctl -R file.m2t .Pp Receive an MPEG TS stream from a camera producing MPEG transport stream. This has been tested with SONY HDR-FX1E camera that produces HD @@ -169,7 +169,7 @@ .Pp To send the stream from the camera over the network using TCP (which supprisingly works better with vlc), you can use -.Dl fwcontrol -R - | nc 192.168.10.11 9000 +.Dl fwctl -R - | nc 192.168.10.11 9000 with .Pa pkgsrc/net/netcat and to receive the stream, use @@ -180,7 +180,7 @@ since vlc is not fast enough to read UDP packets from buffers and thus it experiences dropouts when run directly. The sending side can use -.Dl fwcontrol -R - | nc 192.168.10.11 9000 +.Dl fwctl -R - | nc 192.168.10.11 9000 and to receive the stream, use .Dl nc -l -u -p 9000 | buffer -s 10k -b 1000 -m 20m -p 5 | vlc - .Pp
CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: pgoyette Date: Sat Aug 14 16:32:26 UTC 2010 Modified Files: src/usr.sbin/fwctl: fwctl.8 Log Message: Fix a typo To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/fwctl/fwctl.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/fwctl.8 diff -u src/usr.sbin/fwctl/fwctl.8:1.9 src/usr.sbin/fwctl/fwctl.8:1.10 --- src/usr.sbin/fwctl/fwctl.8:1.9 Sat Aug 14 16:23:49 2010 +++ src/usr.sbin/fwctl/fwctl.8 Sat Aug 14 16:32:26 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: fwctl.8,v 1.9 2010/08/14 16:23:49 cegger Exp $ +.\ $NetBSD: fwctl.8,v 1.10 2010/08/14 16:32:26 pgoyette Exp $ .\ .\ Copyright (c) 2005 KIYOHARA Takashi .\ All rights reserved. @@ -77,7 +77,8 @@ by phy_config packet. .It Fl l Ar file Load hex dump file of the configuration ROM and parse it. -.It Fl M Ar modeExplicitly specify either +.It Fl M Ar mode +Explicitly specify either .Ar dv or .Ar mpeg
CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: cegger Date: Sat Jul 31 07:05:32 UTC 2010 Modified Files: src/usr.sbin/fwctl: eui64.c Log Message: remove useless brackets. From kiyohara@ To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/fwctl/eui64.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/eui64.c diff -u src/usr.sbin/fwctl/eui64.c:1.2 src/usr.sbin/fwctl/eui64.c:1.3 --- src/usr.sbin/fwctl/eui64.c:1.2 Wed Apr 15 06:02:37 2009 +++ src/usr.sbin/fwctl/eui64.c Sat Jul 31 07:05:32 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: eui64.c,v 1.2 2009/04/15 06:02:37 lukem Exp $ */ +/* $NetBSD: eui64.c,v 1.3 2010/07/31 07:05:32 cegger Exp $ */ /* * Copyright 2004 The Aerospace Corporation. All rights reserved. * @@ -108,7 +108,7 @@ linehead = strdup(l); if (linehead == NULL) - return (-1); + return -1; line = linehead; /* Find and parse the EUI64 */ @@ -139,11 +139,11 @@ goto bad; } - return (0); + return 0; bad: free(linehead); - return (-1); + return -1; } /* @@ -187,7 +187,7 @@ goto good; } - return (-1); + return -1; good: e-octet[0]=o0; @@ -199,7 +199,7 @@ e-octet[6]=o6; e-octet[7]=o7; -return (0); +return 0; } /* @@ -214,8 +214,8 @@ id-octet[0], id-octet[1], id-octet[2], id-octet[3], id-octet[4], id-octet[5], id-octet[6], id-octet[7]); if (i 23 || i = (int)len) -return (-1); -return (0); +return -1; +return 0; } /* @@ -235,7 +235,7 @@ char *yp_domain; #endif if ((fp = fopen(_PATH_EUI64, r)) == NULL) - return (1); + return 1; while (fgets(buf,BUFSIZ,fp)) { if (buf[0] == '#') @@ -261,12 +261,12 @@ /* We have a match */ strcpy(hostname, local_host); fclose(fp); -return(0); +return 0; } } } fclose(fp); - return (1); + return 1; } /* @@ -285,7 +285,7 @@ char *yp_domain; #endif if ((fp = fopen(_PATH_EUI64, r)) == NULL) - return (1); + return 1; while (fgets(buf,BUFSIZ,fp)) { if (buf[0] == '#') @@ -309,10 +309,10 @@ /* We have a match */ bcopy(local_eui64, id, sizeof(struct eui64)); fclose(fp); -return(0); +return 0; } } } fclose(fp); - return (1); + return 1; }
CVS commit: src/usr.sbin/fwctl
Module Name:src Committed By: cegger Date: Mon Mar 29 10:49:34 UTC 2010 Modified Files: src/usr.sbin/fwctl: fwcontrol.c Log Message: make this build again after ieee1394 update To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/fwctl/fwcontrol.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/fwctl/fwcontrol.c diff -u src/usr.sbin/fwctl/fwcontrol.c:1.7 src/usr.sbin/fwctl/fwcontrol.c:1.8 --- src/usr.sbin/fwctl/fwcontrol.c:1.7 Fri May 2 19:59:19 2008 +++ src/usr.sbin/fwctl/fwcontrol.c Mon Mar 29 10:49:34 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: fwcontrol.c,v 1.7 2008/05/02 19:59:19 xtraeme Exp $ */ +/* $NetBSD: fwcontrol.c,v 1.8 2010/03/29 10:49:34 cegger Exp $ */ /* * Copyright (C) 2002 * Hidetoshi Shimokawa. All rights reserved. @@ -503,13 +503,12 @@ printf(%02d sequel packet\n, sid.p0.phy_id); continue; } - printf(%02d %2d %2d %4s %d%d %3s + printf(%02d %2d %2d %4s %d%3s %s %s %s %d%d\n, sid.p0.phy_id, sid.p0.link_active, sid.p0.gap_count, speed[sid.p0.phy_speed], - sid.p0.phy_delay, sid.p0.contender, pwr_class[sid.p0.power_class], port_status[sid.p0.port0],