4 (c) 2008 Yanira <forum-2008@email.de>
5 (c) 2012 Jo-Philipp Wich <jow@openwrt.org>
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
15 local uci = luci.model.uci.cursor_state()
16 local net = require "luci.model.network"
19 m = Map("p910nd", translate("p910nd - Printer server"),
20 translatef("First you have to install the packages to get support for USB (kmod-usb-printer) or parallel port (kmod-lp)."))
24 s = m:section(TypedSection, "p910nd", translate("Settings"))
28 s:option(Flag, "enabled", translate("enable"))
30 s:option(Value, "device", translate("Device")).rmempty = true
32 b = s:option(Value, "bind", translate("Interface"), translate("Specifies the interface to listen on."))
33 b.template = "cbi/network_netlist"
37 function b.cfgvalue(...)
38 local v = Value.cfgvalue(...)
40 return (net:get_status_by_address(v))
44 function b.write(self, section, value)
45 local n = net:get_network(value)
46 if n and n:ipaddr() then
47 Value.write(self, section, n:ipaddr())
51 p = s:option(ListValue, "port", translate("Port"), translate("TCP listener port."))
57 s:option(Flag, "bidirectional", translate("Bidirectional mode"))