Skip to content

Commit

Permalink
[fuji] add set_slot_hostname to rest of platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
nwah authored and tschak909 committed Feb 14, 2025
1 parent 63aae3e commit 8eaf874
Show file tree
Hide file tree
Showing 27 changed files with 249 additions and 164 deletions.
7 changes: 7 additions & 0 deletions lib/device/adamnet/fuji.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,13 @@ void adamFuji::adamnet_get_host_prefix()
{
}

// Public method to update host in specific slot
fujiHost *adamFuji::set_slot_hostname(int host_slot, char *hostname)
{
_fnHosts[host_slot].set_hostname(hostname);
return &_fnHosts[host_slot];
}

// Send device slot data to computer
void adamFuji::adamnet_read_device_slots()
{
Expand Down
5 changes: 3 additions & 2 deletions lib/device/adamnet/fuji.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ class adamFuji : public virtualDevice

public:
bool boot_config = true;

bool status_wait_enabled = true;

adamDisk *bootdisk();

adamNetwork *network();
Expand All @@ -155,6 +155,7 @@ class adamFuji : public virtualDevice

fujiHost *get_hosts(int i) { return &_fnHosts[i]; }
fujiDisk *get_disks(int i) { return &_fnDisks[i]; }
fujiHost *set_slot_hostname(int host_slot, char *hostname);

void _populate_slots_from_config();
void _populate_config_from_slots();
Expand Down
15 changes: 11 additions & 4 deletions lib/device/comlynx/fuji.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ void lynxFuji::comlynx_read_app_key()
response_len = 1; // if no file found set return length to 1 or lynx hangs waiting for response
return;
}

response_len = fread(response, sizeof(char), 64, fp);
fclose(fp);

Expand Down Expand Up @@ -948,6 +948,13 @@ void lynxFuji::comlynx_get_host_prefix()
{
}

// Public method to update host in specific slot
fujiHost *lynxFuji::set_slot_hostname(int host_slot, char *hostname)
{
_fnHosts[host_slot].set_hostname(hostname);
return &_fnHosts[host_slot];
}

// Send device slot data to computer
void lynxFuji::comlynx_read_device_slots()
{
Expand Down Expand Up @@ -1193,7 +1200,7 @@ void lynxFuji::comlynx_disable_device()
}

Config.save();

ComLynx.disableDevice(d);

comlynx_response_ack();
Expand Down Expand Up @@ -1226,7 +1233,7 @@ void lynxFuji::comlynx_random_number()

response_len = sizeof(int);
*p = rand();

comlynx_response_ack();
}

Expand Down Expand Up @@ -1460,7 +1467,7 @@ void lynxFuji::comlynx_process(uint8_t b)
{
unsigned char c = b >> 4;
Debug_printf("%02x \n",c);

switch (c)
{
case MN_STATUS:
Expand Down
5 changes: 3 additions & 2 deletions lib/device/comlynx/fuji.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ class lynxFuji : public virtualDevice

public:
bool boot_config = true;

bool status_wait_enabled = true;

lynxDisk *bootdisk();

lynxNetwork *network();
Expand All @@ -156,6 +156,7 @@ class lynxFuji : public virtualDevice

fujiHost *get_hosts(int i) { return &_fnHosts[i]; }
fujiDisk *get_disks(int i) { return &_fnDisks[i]; }
fujiHost *set_slot_hostname(int host_slot, char *hostname);

void _populate_slots_from_config();
void _populate_config_from_slots();
Expand Down
17 changes: 12 additions & 5 deletions lib/device/cx16_i2c/fuji.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@ void cx16Fuji::disk_image_mount()
cx16_error();
return;
}

if (!_validate_host_slot(_fnDisks[deviceSlot].host_slot))
{
cx16_error();
return;
}

// A couple of reference variables to make things much easier to read...
fujiDisk &disk = _fnDisks[deviceSlot];
fujiHost &host = _fnHosts[disk.host_slot];
Expand Down Expand Up @@ -1126,6 +1126,13 @@ void cx16Fuji::get_host_prefix()
bus_to_computer((uint8_t *)prefix, sizeof(prefix), false);
}

// Public method to update host in specific slot
fujiHost *cx16_i2c::set_slot_hostname(int host_slot, char *hostname)
{
_fnHosts[host_slot].set_hostname(hostname);
return &_fnHosts[host_slot];
}

// Send device slot data to computer
void cx16Fuji::read_device_slots()
{
Expand Down Expand Up @@ -1379,9 +1386,9 @@ void cx16Fuji::setup(systemBus *siobus)

// Disable booting from CONFIG if our settings say to turn it off
boot_config = Config.get_general_config_enabled();

//Disable status_wait if our settings say to turn it off
status_wait_enabled = Config.get_general_status_wait_enabled();
status_wait_enabled = Config.get_general_status_wait_enabled();
}

void cx16Fuji::process(uint32_t commanddata, uint8_t checksum)
Expand Down Expand Up @@ -1549,4 +1556,4 @@ std::string cx16Fuji::get_host_prefix(int host_slot)
return _fnHosts[host_slot].get_prefix();
}

#endif /* BUILD_CX16 */
#endif /* BUILD_CX16 */
5 changes: 3 additions & 2 deletions lib/device/cx16_i2c/fuji.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class cx16Fuji : public virtualDevice
bool boot_config = true;

bool status_wait_enabled = true;

//sioNetwork *network();

void debug_tape();
Expand All @@ -131,6 +131,7 @@ class cx16Fuji : public virtualDevice

fujiHost *get_hosts(int i) { return &_fnHosts[i]; }
fujiDisk *get_disks(int i) { return &_fnDisks[i]; }
fujiHost *set_slot_hostname(int host_slot, char *hostname);

void _populate_slots_from_config();
void _populate_config_from_slots();
Expand All @@ -142,4 +143,4 @@ class cx16Fuji : public virtualDevice

extern cx16Fuji theFuji;

#endif /* FUJI_H */
#endif /* FUJI_H */
23 changes: 15 additions & 8 deletions lib/device/drivewire/fuji.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ void drivewireFuji::read_app_key()
size_t count = fread(buffer.data(), 1, buffer.size(), fIn);
fclose(fIn);
Debug_printf("Read %d bytes from input file\n", count);

uint16_t sizeNetOrder = htons(count);

response.clear();
Expand Down Expand Up @@ -909,7 +909,7 @@ void drivewireFuji::read_directory_entry()
current_entry[filelen + 1] = '\0';
}
}

response.clear();
response.shrink_to_fit();

Expand Down Expand Up @@ -959,7 +959,7 @@ void drivewireFuji::close_directory()
errorCode = 1;
}

// Get network adapter configuration
// Get network adapter configuration
void drivewireFuji::get_adapter_config()
{
Debug_println("Fuji cmd: GET ADAPTER CONFIG");
Expand Down Expand Up @@ -1401,7 +1401,7 @@ void drivewireFuji::base64_encode_compute()
void drivewireFuji::base64_encode_length()
{
size_t l = base64.base64_buffer.length();
uint8_t o[4] =
uint8_t o[4] =
{
(uint8_t)(l >> 24),
(uint8_t)(l >> 16),
Expand All @@ -1426,7 +1426,7 @@ void drivewireFuji::base64_encode_output()
if (!len)
{
Debug_printf("Refusing to send zero byte buffer. Exiting.");
errorCode = 144;
errorCode = 144;
return;
}

Expand All @@ -1436,7 +1436,7 @@ void drivewireFuji::base64_encode_output()
base64.base64_buffer.shrink_to_fit();

response = std::string((const char *)p.data(), len);
errorCode = 1;
errorCode = 1;
}

void drivewireFuji::base64_decode_input()
Expand Down Expand Up @@ -1637,6 +1637,13 @@ std::string drivewireFuji::get_host_prefix(int host_slot)
return _fnHosts[host_slot].get_prefix();
}

// Public method to update host in specific slot
fujiHost *drivewireFuji::set_slot_hostname(int host_slot, char *hostname)
{
_fnHosts[host_slot].set_hostname(hostname);
return &_fnHosts[host_slot];
}

void drivewireFuji::send_error()
{
Debug_printf("drivewireFuji::send_error(%u)\n",errorCode);
Expand All @@ -1662,7 +1669,7 @@ void drivewireFuji::send_response()

// Clear the response
response.clear();
response.shrink_to_fit();
response.shrink_to_fit();
}

void drivewireFuji::ready()
Expand Down Expand Up @@ -1822,4 +1829,4 @@ void drivewireFuji::process()
}
}

#endif /* BUILD_COCO */
#endif /* BUILD_COCO */
2 changes: 1 addition & 1 deletion lib/device/drivewire/fuji.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ class drivewireFuji : public virtualDevice

fujiHost *get_hosts(int i) { return &_fnHosts[i]; }
fujiDisk *get_disks(int i) { return &_fnDisks[i]; }
fujiHost *set_slot_hostname(int host_slot, char *hostname);

void _populate_slots_from_config();
void _populate_config_from_slots();
Expand All @@ -210,4 +211,3 @@ class drivewireFuji : public virtualDevice
extern drivewireFuji theFuji;

#endif // FUJI_H

7 changes: 7 additions & 0 deletions lib/device/h89/fuji.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,13 @@ void H89Fuji::H89_get_host_prefix()
{
}

// Public method to update host in specific slot
fujiHost *H89Fuji::set_slot_hostname(int host_slot, char *hostname)
{
_fnHosts[host_slot].set_hostname(hostname);
return &_fnHosts[host_slot];
}

// Send device slot data to computer
void H89Fuji::H89_read_device_slots()
{
Expand Down
5 changes: 3 additions & 2 deletions lib/device/h89/fuji.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ class H89Fuji : public virtualDevice

public:
bool boot_config = true;

bool status_wait_enabled = true;

H89Disk *bootdisk();

H89Network *network();
Expand All @@ -146,6 +146,7 @@ class H89Fuji : public virtualDevice

fujiHost *get_hosts(int i) { return &_fnHosts[i]; }
fujiDisk *get_disks(int i) { return &_fnDisks[i]; }
fujiHost *set_slot_hostname(int host_slot, char *hostname);

void _populate_slots_from_config();
void _populate_config_from_slots();
Expand Down
Loading

0 comments on commit 8eaf874

Please sign in to comment.