Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ Start `pcscd` on systemd based distribution: `sudo systemctl start pcscd`

Card reader is not connected.

## About OnlyPreview Feature

This is an experimental feature that only previews card information without downloading it into the card. It allows for writing to other cards again.

Some carriers, such as Tele2, do not follow the standard protocol, which may result in a "Refused" status when attempting to write to the card again.

Please test and evaluate the risks on your own.

## Other `SCard` error codes

For complete explanation list of PCSC error codes, see [pcsc-lite: ErrorCodes](https://pcsclite.apdu.fr/api/group__ErrorCodes.html)
13 changes: 12 additions & 1 deletion cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,20 @@ func LpacProfileDownload(info PullInfo) {
if info.IMEI != "" {
args = append(args, "-i", info.IMEI)
}
if info.OnlyPreview == true {
args = append(args, "-p")
}
_, err := runLpac(args...)
if err != nil {
ShowLpacErrDialog(err)
if info.OnlyPreview == true && strings.Contains(strings.ToLower(err.Error()), "cancelled") {
// Only Preview Normally
dialogText := "Preview Download successful"
dialog.ShowInformation("Info", dialogText, WMain)
return
} else {
ShowLpacErrDialog(err)
return
}
} else {
notificationOrigin := Notifications
Refresh()
Expand Down
1 change: 1 addition & 0 deletions struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type PullInfo struct {
ObjectID string
ConfirmCode string
IMEI string
OnlyPreview bool
}

type LpacReturnValue struct {
Expand Down
4 changes: 3 additions & 1 deletion window.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,14 @@ func InitDownloadDialog() dialog.Dialog {
matchIDEntry := &widget.Entry{PlaceHolder: "Activation code. Optional"}
confirmCodeEntry := &widget.Entry{PlaceHolder: "Optional"}
imeiEntry := &widget.Entry{PlaceHolder: "The IMEI sent to SM-DP+. Optional"}
onlyPreview := widget.NewCheck("Only Preview", nil)

formItems := []*widget.FormItem{
{Text: "SM-DP+", Widget: smdpEntry},
{Text: "Matching ID", Widget: matchIDEntry},
{Text: "Confirm Code", Widget: confirmCodeEntry},
{Text: "IMEI", Widget: imeiEntry},
{Text: "Only Preview", Widget: onlyPreview},
}

form := widget.NewForm(formItems...)
Expand Down Expand Up @@ -251,6 +253,7 @@ func InitDownloadDialog() dialog.Dialog {
MatchID: strings.TrimSpace(matchIDEntry.Text),
ConfirmCode: strings.TrimSpace(confirmCodeEntry.Text),
IMEI: strings.TrimSpace(imeiEntry.Text),
OnlyPreview: onlyPreview.Checked,
}
go func() {
err := RefreshNotification()
Expand All @@ -277,7 +280,6 @@ func InitDownloadDialog() dialog.Dialog {
selectQRCodeButton.Enable()
pasteFromClipboardButton.Enable()
}

selectQRCodeButton = &widget.Button{
Text: "Scan image file",
Icon: theme.FileImageIcon(),
Expand Down