unsigned int slLen;
-// if (len > 0)
-// hexDump(data, len);
+ if (len > 0)
+ hexDump(data, len);
if (len == -1) {
-// printf("Received No or Invalid Packet\n");
+ printf("Received No or Invalid Packet\n");
return -1;
}
if (memcmp(&data[8], myMac, 6) | data[0] != 0x01 | (!(data[1] == 0x02 | data[1] == 0x04))) {
if (ddev == NULL) {
ddev = (struct gs105e_discovered *)malloc(sizeof(struct gs105e_discovered));
gs105e_devs = ddev;
+ ddev->next = NULL;
}else {
while (ddev != NULL) {
- if (memcmp(ddev->mac, settings.mac, 6))
+ if (memcmp(ddev->mac, settings.mac, 6)) {
+ ddev = ddev->next;
continue;
- ddev = ddev->next;
+ }
+
+ break;
}
+
}
if (ddev == NULL) {
- struct gs105e_discovered * ddev = gs105e_devs;
+
+ ddev = gs105e_devs;
gs105e_devs = (struct gs105e_discovered *)malloc(sizeof(struct gs105e_discovered));
+ printf("%p\n", gs105e_devs);
+ printf("%p\n", ddev);
gs105e_devs->next = ddev;
ddev = gs105e_devs;
+ printf("%p\n", ddev);
+
}
- ddev->name = settings.name;
+
+ printf("%p\n", ddev);
+ ddev->name = (char *)realloc(ddev->name, sizeof(char) * strlen(settings.name));
+ printf("DEBUG 1\n");
+ memcpy(ddev->name, settings.name, strlen(settings.name) + 1);
memcpy(ddev->mac, settings.mac, 6);
+
memcpy(ddev->ip, settings.ip, 4);
memcpy(ddev->gateway, settings.gateway, 4);
- ddev->model = settings.model;
+ ddev->model = (char *)malloc(sizeof(char) * strlen(settings.model));
+ memcpy(ddev->model, settings.model, strlen(settings.model) + 1);
+
ddev->id = id;
}
gs105e_query ();
gs105e_query ();
while (gs105e__receive() == 0) {
+ printf("DEGUB DEVICE DISCOVERED\n");
addDiscoveredDevice(n + 1);
+
n++;
}
return n;
printf("Invalid Port ID\n");
return;
}
-
+ o = m;
m = (0x80 >> ((m & 0xFF) - 1)) | (int)vl->members;
-
+ printf("%i %i\n", (int)vl->tag, (unsigned int)(~((unsigned char)m)));
if (strncmp(argv[4], "T", 1) == 0) {
- o = (int)vl->tag | m;
+ o = (int)vl->tag | (0x80 >> ((o & 0xFF) - 1));
}else if (strncmp(argv[4], "U", 1) == 0) {
- o = (int)vl->tag &(~((char)m));
+ o = (int)vl->tag &(~((0x80 >> ((o & 0xFF) - 1))));
}
password();
printError(gs105e_setVlanMembers(n, m, o));