LUN0='gadget-lun0'
LUN1='gadget-lun1'
- if [ $# = 0 ]; then
- # unload all
- echo "" > $GADGETPATH/$LUN0/file
- echo "" > $GADGETPATH/$LUN1/file
- exit 0
- fi
-
- # NOTE: works only for 1 or 2 device arguments
- for lun in $LUN0 $LUN1; do
- grep $1 $GADGETPATH/$lun/file > /dev/null
- RC=$?
-
- if [ $# = 2 ]; then
- grep $2 $GADGETPATH/$lun/file > /dev/null
- RC2=$?
- else
- RC2=1
- fi
-
- if [ $RC = 0 -o $RC2 = 0 ]; then
- echo "" > $GADGETPATH/$lun/file
- fi
- done
+ # unload all
+ echo "" > $GADGETPATH/$LUN0/file
+ echo "" > $GADGETPATH/$LUN1/file
/sbin/rmmod g_file_storage
if [ $? != 0 ]; then
logger "$0: failed to install g_ether"
exit 1
fi
-
+
exit 0
+
static const in_addr_t HOST_BASE_ADDRESS = 0xc0a8ff00;
// Host order 255.255.255.252
static const in_addr_t HOST_NETMASK = 0xfffffffc;
-// Host order 0.0.0.2
-static const in_addr_t HOST_ROUTER = 0x00000002;
// Host order 0.0.0.1
-static const in_addr_t HOST_DHCP = 0x00000001;
+static const in_addr_t HOST_ROUTER = 0x00000001;
+// Host order 0.0.0.1
+static const in_addr_t HOST_DHCP = 0x00000002;
struct _MTetherDDevicePrivate {
gchar *interface;
if (index < 64) {
in_addr_t subnet = HOST_BASE_ADDRESS | (index << 2);
in_addr_t addr = subnet | HOST_ROUTER;
- in_addr_t start = subnet | HOST_DHCP;
+ in_addr_t end = subnet | HOST_DHCP;
self->priv->addr = htonl(addr);
self->priv->netmask = htonl(HOST_NETMASK);
- self->priv->dhcp_start = htonl(start);
- self->priv->dhcp_end = htonl(addr);
+ self->priv->dhcp_start = htonl(addr);
+ self->priv->dhcp_end = htonl(end);
} else {
g_log(MTETHERD_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "Invalid subnet index: %u (0..%u expected)", index, MAX_DEVICES - 1);
}