File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 2121* SOFTWARE.
2222*/
2323
24+ import { StringDecoder } from "string_decoder" ;
2425import { CmsisDAP , DAPProtocol , DEFAULT_CLOCK_FREQUENCY } from "../proxy" ;
2526import { Transport } from "../transport" ;
2627import { DAPLinkFlash , DAPLinkSerial } from "./enums" ;
@@ -256,9 +257,9 @@ export class DAPLink extends CmsisDAP {
256257 }
257258
258259 if ( serialData !== undefined ) {
259- const numberArray = Array . prototype . slice . call ( new Uint8Array ( serialData ) ) ;
260- const data = String . fromCharCode . apply ( null , numberArray ) ;
261- this . emit ( DAPLink . EVENT_SERIAL_DATA , data ) ;
260+ const buffer = Buffer . from ( serialData ) ;
261+ const decoder = new StringDecoder ( "utf8" ) ;
262+ this . emit ( DAPLink . EVENT_SERIAL_DATA , decoder . write ( buffer ) ) ;
262263 }
263264 }
264265
You can’t perform that action at this time.
0 commit comments