Skip to content

Commit 8eaf874

Browse files
nwahtschak909
authored andcommitted
[fuji] add set_slot_hostname to rest of platforms
1 parent 63aae3e commit 8eaf874

File tree

27 files changed

+249
-164
lines changed

27 files changed

+249
-164
lines changed

lib/device/adamnet/fuji.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,13 @@ void adamFuji::adamnet_get_host_prefix()
999999
{
10001000
}
10011001

1002+
// Public method to update host in specific slot
1003+
fujiHost *adamFuji::set_slot_hostname(int host_slot, char *hostname)
1004+
{
1005+
_fnHosts[host_slot].set_hostname(hostname);
1006+
return &_fnHosts[host_slot];
1007+
}
1008+
10021009
// Send device slot data to computer
10031010
void adamFuji::adamnet_read_device_slots()
10041011
{

lib/device/adamnet/fuji.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ class adamFuji : public virtualDevice
136136

137137
public:
138138
bool boot_config = true;
139-
139+
140140
bool status_wait_enabled = true;
141-
141+
142142
adamDisk *bootdisk();
143143

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

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

159160
void _populate_slots_from_config();
160161
void _populate_config_from_slots();

lib/device/comlynx/fuji.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ void lynxFuji::comlynx_read_app_key()
536536
response_len = 1; // if no file found set return length to 1 or lynx hangs waiting for response
537537
return;
538538
}
539-
539+
540540
response_len = fread(response, sizeof(char), 64, fp);
541541
fclose(fp);
542542

@@ -948,6 +948,13 @@ void lynxFuji::comlynx_get_host_prefix()
948948
{
949949
}
950950

951+
// Public method to update host in specific slot
952+
fujiHost *lynxFuji::set_slot_hostname(int host_slot, char *hostname)
953+
{
954+
_fnHosts[host_slot].set_hostname(hostname);
955+
return &_fnHosts[host_slot];
956+
}
957+
951958
// Send device slot data to computer
952959
void lynxFuji::comlynx_read_device_slots()
953960
{
@@ -1193,7 +1200,7 @@ void lynxFuji::comlynx_disable_device()
11931200
}
11941201

11951202
Config.save();
1196-
1203+
11971204
ComLynx.disableDevice(d);
11981205

11991206
comlynx_response_ack();
@@ -1226,7 +1233,7 @@ void lynxFuji::comlynx_random_number()
12261233

12271234
response_len = sizeof(int);
12281235
*p = rand();
1229-
1236+
12301237
comlynx_response_ack();
12311238
}
12321239

@@ -1460,7 +1467,7 @@ void lynxFuji::comlynx_process(uint8_t b)
14601467
{
14611468
unsigned char c = b >> 4;
14621469
Debug_printf("%02x \n",c);
1463-
1470+
14641471
switch (c)
14651472
{
14661473
case MN_STATUS:

lib/device/comlynx/fuji.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ class lynxFuji : public virtualDevice
137137

138138
public:
139139
bool boot_config = true;
140-
140+
141141
bool status_wait_enabled = true;
142-
142+
143143
lynxDisk *bootdisk();
144144

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

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

160161
void _populate_slots_from_config();
161162
void _populate_config_from_slots();

lib/device/cx16_i2c/fuji.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,13 @@ void cx16Fuji::disk_image_mount()
261261
cx16_error();
262262
return;
263263
}
264-
264+
265265
if (!_validate_host_slot(_fnDisks[deviceSlot].host_slot))
266266
{
267267
cx16_error();
268268
return;
269269
}
270-
270+
271271
// A couple of reference variables to make things much easier to read...
272272
fujiDisk &disk = _fnDisks[deviceSlot];
273273
fujiHost &host = _fnHosts[disk.host_slot];
@@ -1126,6 +1126,13 @@ void cx16Fuji::get_host_prefix()
11261126
bus_to_computer((uint8_t *)prefix, sizeof(prefix), false);
11271127
}
11281128

1129+
// Public method to update host in specific slot
1130+
fujiHost *cx16_i2c::set_slot_hostname(int host_slot, char *hostname)
1131+
{
1132+
_fnHosts[host_slot].set_hostname(hostname);
1133+
return &_fnHosts[host_slot];
1134+
}
1135+
11291136
// Send device slot data to computer
11301137
void cx16Fuji::read_device_slots()
11311138
{
@@ -1379,9 +1386,9 @@ void cx16Fuji::setup(systemBus *siobus)
13791386

13801387
// Disable booting from CONFIG if our settings say to turn it off
13811388
boot_config = Config.get_general_config_enabled();
1382-
1389+
13831390
//Disable status_wait if our settings say to turn it off
1384-
status_wait_enabled = Config.get_general_status_wait_enabled();
1391+
status_wait_enabled = Config.get_general_status_wait_enabled();
13851392
}
13861393

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

1552-
#endif /* BUILD_CX16 */
1559+
#endif /* BUILD_CX16 */

lib/device/cx16_i2c/fuji.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class cx16Fuji : public virtualDevice
116116
bool boot_config = true;
117117

118118
bool status_wait_enabled = true;
119-
119+
120120
//sioNetwork *network();
121121

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

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

135136
void _populate_slots_from_config();
136137
void _populate_config_from_slots();
@@ -142,4 +143,4 @@ class cx16Fuji : public virtualDevice
142143

143144
extern cx16Fuji theFuji;
144145

145-
#endif /* FUJI_H */
146+
#endif /* FUJI_H */

lib/device/drivewire/fuji.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ void drivewireFuji::read_app_key()
703703
size_t count = fread(buffer.data(), 1, buffer.size(), fIn);
704704
fclose(fIn);
705705
Debug_printf("Read %d bytes from input file\n", count);
706-
706+
707707
uint16_t sizeNetOrder = htons(count);
708708

709709
response.clear();
@@ -909,7 +909,7 @@ void drivewireFuji::read_directory_entry()
909909
current_entry[filelen + 1] = '\0';
910910
}
911911
}
912-
912+
913913
response.clear();
914914
response.shrink_to_fit();
915915

@@ -959,7 +959,7 @@ void drivewireFuji::close_directory()
959959
errorCode = 1;
960960
}
961961

962-
// Get network adapter configuration
962+
// Get network adapter configuration
963963
void drivewireFuji::get_adapter_config()
964964
{
965965
Debug_println("Fuji cmd: GET ADAPTER CONFIG");
@@ -1401,7 +1401,7 @@ void drivewireFuji::base64_encode_compute()
14011401
void drivewireFuji::base64_encode_length()
14021402
{
14031403
size_t l = base64.base64_buffer.length();
1404-
uint8_t o[4] =
1404+
uint8_t o[4] =
14051405
{
14061406
(uint8_t)(l >> 24),
14071407
(uint8_t)(l >> 16),
@@ -1426,7 +1426,7 @@ void drivewireFuji::base64_encode_output()
14261426
if (!len)
14271427
{
14281428
Debug_printf("Refusing to send zero byte buffer. Exiting.");
1429-
errorCode = 144;
1429+
errorCode = 144;
14301430
return;
14311431
}
14321432

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

14381438
response = std::string((const char *)p.data(), len);
1439-
errorCode = 1;
1439+
errorCode = 1;
14401440
}
14411441

14421442
void drivewireFuji::base64_decode_input()
@@ -1637,6 +1637,13 @@ std::string drivewireFuji::get_host_prefix(int host_slot)
16371637
return _fnHosts[host_slot].get_prefix();
16381638
}
16391639

1640+
// Public method to update host in specific slot
1641+
fujiHost *drivewireFuji::set_slot_hostname(int host_slot, char *hostname)
1642+
{
1643+
_fnHosts[host_slot].set_hostname(hostname);
1644+
return &_fnHosts[host_slot];
1645+
}
1646+
16401647
void drivewireFuji::send_error()
16411648
{
16421649
Debug_printf("drivewireFuji::send_error(%u)\n",errorCode);
@@ -1662,7 +1669,7 @@ void drivewireFuji::send_response()
16621669

16631670
// Clear the response
16641671
response.clear();
1665-
response.shrink_to_fit();
1672+
response.shrink_to_fit();
16661673
}
16671674

16681675
void drivewireFuji::ready()
@@ -1822,4 +1829,4 @@ void drivewireFuji::process()
18221829
}
18231830
}
18241831

1825-
#endif /* BUILD_COCO */
1832+
#endif /* BUILD_COCO */

lib/device/drivewire/fuji.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ class drivewireFuji : public virtualDevice
196196

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

200201
void _populate_slots_from_config();
201202
void _populate_config_from_slots();
@@ -210,4 +211,3 @@ class drivewireFuji : public virtualDevice
210211
extern drivewireFuji theFuji;
211212

212213
#endif // FUJI_H
213-

lib/device/h89/fuji.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,13 @@ void H89Fuji::H89_get_host_prefix()
245245
{
246246
}
247247

248+
// Public method to update host in specific slot
249+
fujiHost *H89Fuji::set_slot_hostname(int host_slot, char *hostname)
250+
{
251+
_fnHosts[host_slot].set_hostname(hostname);
252+
return &_fnHosts[host_slot];
253+
}
254+
248255
// Send device slot data to computer
249256
void H89Fuji::H89_read_device_slots()
250257
{

lib/device/h89/fuji.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ class H89Fuji : public virtualDevice
127127

128128
public:
129129
bool boot_config = true;
130-
130+
131131
bool status_wait_enabled = true;
132-
132+
133133
H89Disk *bootdisk();
134134

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

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

150151
void _populate_slots_from_config();
151152
void _populate_config_from_slots();

0 commit comments

Comments
 (0)