File tree 1 file changed +34
-0
lines changed
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -195,6 +195,40 @@ int cmd_extras() {
195
195
}
196
196
}
197
197
}
198
+ #ifndef ENABLE_EMULATION
199
+ else if (P1 (apdu ) == 0x1B ) { // Set PHY
200
+ if (apdu .nc == 0 ) {
201
+ if (file_has_data (ef_phy )) {
202
+ res_APDU_size = file_get_size (ef_phy );
203
+ memcpy (res_APDU , file_get_data (ef_phy ), res_APDU_size );
204
+ }
205
+ }
206
+ else {
207
+ uint8_t tmp [PHY_MAX_SIZE ];
208
+ memset (tmp , 0 , sizeof (tmp ));
209
+ if (file_has_data (ef_phy )) {
210
+ memcpy (tmp , file_get_data (ef_phy ), MIN (sizeof (tmp ), file_get_size (ef_phy )));
211
+ }
212
+ if (P2 (apdu ) == PHY_VID ) { // VIDPID
213
+ if (apdu .nc != 4 ) {
214
+ return SW_WRONG_LENGTH ();
215
+ }
216
+ memcpy (tmp + PHY_VID , apdu .data , 4 );
217
+ }
218
+ else if (P2 (apdu ) == PHY_LED_GPIO || P2 (apdu ) == PHY_LED_MODE ) {
219
+ if (apdu .nc != 1 ) {
220
+ return SW_WRONG_LENGTH ();
221
+ }
222
+ tmp [P2 (apdu )] = apdu .data [0 ];
223
+ }
224
+ else {
225
+ return SW_INCORRECT_P1P2 ();
226
+ }
227
+ flash_write_data_to_file (ef_phy , tmp , sizeof (tmp ));
228
+ low_flash_available ();
229
+ }
230
+ }
231
+ #endif
198
232
else {
199
233
return SW_INCORRECT_P1P2 ();
200
234
}
You can’t perform that action at this time.
0 commit comments