Add -m option, set default fwmem target.
This commit is contained in:
parent
09745181fd
commit
1be7387c03
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=136845
@ -43,6 +43,7 @@
|
||||
.Op Fl b Ar pri_req
|
||||
.Op Fl R Ar filename
|
||||
.Op Fl S Ar filename
|
||||
.Op Fl m Ar EUI64 | hostname
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
@ -102,6 +103,9 @@ in the
|
||||
Ports Collection.
|
||||
.It Fl S Ar filename
|
||||
Send a DV file as isochronous stream.
|
||||
.It Fl m Ar EUI64 | hostname
|
||||
Set default fwmem target. Hostname will be converted to EUI64 using
|
||||
.Xr eui64 5 .
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
Each DV frame has a fixed size and it is easy to edit the frame order.
|
||||
|
@ -369,6 +369,10 @@ show_crom(u_int32_t *crom_buf)
|
||||
u_int16_t crc;
|
||||
|
||||
printf("first quad: 0x%08x ", *crom_buf);
|
||||
if (crom_buf[0] == 0) {
|
||||
printf("(Invalid Configuration ROM)\n");
|
||||
return;
|
||||
}
|
||||
hdr = (struct csrhdr *)crom_buf;
|
||||
if (hdr->info_len == 1) {
|
||||
/* minimum ROM */
|
||||
@ -595,12 +599,21 @@ open_dev(int *fd, char *devbase)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
sysctl_set_int(char *name, int val)
|
||||
{
|
||||
if (sysctlbyname(name, NULL, NULL, &val, sizeof(int)) < 0)
|
||||
err(1, "sysctl %s failed.", name);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
u_int32_t crom_buf[1024/4];
|
||||
char devbase[1024] = "/dev/fw0";
|
||||
int fd, i, tmp, ch, len=1024;
|
||||
struct fw_eui64 eui;
|
||||
struct eui64 target;
|
||||
|
||||
fd = -1;
|
||||
|
||||
@ -609,7 +622,7 @@ main(int argc, char **argv)
|
||||
list_dev(fd);
|
||||
}
|
||||
|
||||
while ((ch = getopt(argc, argv, "g:o:s:b:prtc:d:l:u:R:S:")) != -1)
|
||||
while ((ch = getopt(argc, argv, "g:m:o:s:b:prtc:d:l:u:R:S:")) != -1)
|
||||
switch(ch) {
|
||||
case 'b':
|
||||
tmp = strtol(optarg, NULL, 0);
|
||||
@ -637,6 +650,15 @@ main(int argc, char **argv)
|
||||
load_crom(optarg, crom_buf);
|
||||
show_crom(crom_buf);
|
||||
break;
|
||||
case 'm':
|
||||
if (eui64_hostton(optarg, &target) != 0 &&
|
||||
eui64_aton(optarg, &target) != 0)
|
||||
errx(1, "invalid target: %s", optarg);
|
||||
eui.hi = ntohl(*(u_int32_t*)&(target.octet[0]));
|
||||
eui.lo = ntohl(*(u_int32_t*)&(target.octet[4]));
|
||||
sysctl_set_int("hw.firewire.fwmem.eui64_hi", eui.hi);
|
||||
sysctl_set_int("hw.firewire.fwmem.eui64_lo", eui.lo);
|
||||
break;
|
||||
case 'o':
|
||||
open_dev(&fd, devbase);
|
||||
tmp = str2node(fd, optarg);
|
||||
|
Loading…
Reference in New Issue
Block a user