IzoT U60 DIN Network Interface User’s Guide
19
The following example rule includes the
-l
parameter with a non-standard value of 16
for the line discipline number:
SUBSYSTEM=="tty", ATTRS{idVendor}=="0920", ATTRS{idProduct}=="5550",
RUN+="/usr/bin/lonifd -l 16 -d /dev/%k"
You will also need to build the lonifd daemon. Source code and a make file is also
included with the U60 driver for the lonifd daemon.
Once you have built the driver and lonifd daemon, and you have created the udev
rule file, you can install the driver in Linux using the insmod command.
This will create a Linux network device. If you create a single U60 driver, the name
will be
/dev/lon0
. This will not be a character device as was typically used for classic
LON drivers. It will instead be a network device that you will access through a
socket interface. The benefit of a network device is that it can be easily used with the
Linux IP stack for supporting LonTalk/IP, for example when communicating with the
BACnet/IP, ICMP (for ping), or SNMP protocols over the U60.
If the U60 driver is initialized correctly, you will see the network interface as one of
the devices listed by the Linux
ifconfig
command.
You can bypass the IP stack to use the U60 driver as just a classic LON driver. The
following example code opens the U60 socket as a raw character device with a packet
socket, bypassing the IP stack:
int sockfd = socket(AF_PACKET, SOCK_RAW, htons(0x8950));
struct ifreq ifr = { 0 };
size_t ifnamelen = strlen(ifname);
memcpy(ifr.ifr_name, ifname, ifnamelen);
if (ioctl(socket, SIOCGIFINDEX, &ifr) < 0) {
return errno;
}
struct sockaddr_ll addr = { 0 };
addr.sll_family = AF_PACKET;
addr.sll_ifindex = ifr.ifr_ifindex;
if (bind(socket, (struct sockaddr*) &addr, sizeof(struct
sockaddr_ll)) < 0) {
return errno;
}
Using this example code, you can read and write the
sockd
device using the same
code used for other classic LON drivers.
Host Communications
The U60 communicates with a host over a USB connection using the U60 link-layer
protocol (LLP). The driver manages the host end of the U60 LLP, and initializes the
Содержание IzoT U60 DIN
Страница 5: ......
Страница 18: ...IzoT U60 DIN Network Interface User s Guide 16...
Страница 30: ...IzoT U60 DIN Network Interface User s Guide 28...
Страница 34: ......