pax_global_header 0000666 0000000 0000000 00000000064 15060530456 0014516 g ustar 00root root 0000000 0000000 52 comment=ea8525f21c2d9fbb6e6f29df1704bf10de133bba
sfp-master-1.0.7/ 0000775 0000000 0000000 00000000000 15060530456 0013604 5 ustar 00root root 0000000 0000000 sfp-master-1.0.7/.circleci/ 0000775 0000000 0000000 00000000000 15060530456 0015437 5 ustar 00root root 0000000 0000000 sfp-master-1.0.7/.circleci/config.yml 0000664 0000000 0000000 00000004544 15060530456 0017436 0 ustar 00root root 0000000 0000000 # Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1
debian_only: &debian_only
filters:
branches:
only: /debian\/.*/
shared: &shared
steps:
- checkout
- run:
name: Prepare environment
command: |
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
apt-get update
apt-get dist-upgrade -y
- run:
name: Install dependencies
command: |
apt-get install -y devscripts equivs
mk-build-deps -B --install --tool='apt-get -o Debug::pkgProblemResolver=yes --yes' debian/control
- run:
name: Build packages
working_directory: .
command: dpkg-buildpackage -us -uc -b
- run:
name: Save generate packages as artifacts
working_directory: ..
command: |
mkdir /tmp/artifacts
mv *.deb /tmp/artifacts
- store_artifacts:
path: /tmp/artifacts
jobs:
debian10:
<<: *shared
docker:
- image: library/debian:buster
debian11:
<<: *shared
docker:
- image: library/debian:bullseye
debian12:
<<: *shared
docker:
- image: library/debian:bookworm
debian13:
<<: *shared
docker:
- image: library/debian:trixie
ubuntu1404:
<<: *shared
docker:
- image: library/ubuntu:trusty
ubuntu1604:
<<: *shared
docker:
- image: library/ubuntu:xenial
ubuntu1804:
<<: *shared
docker:
- image: library/ubuntu:bionic
ubuntu2004:
<<: *shared
docker:
- image: library/ubuntu:focal
ubuntu2204:
<<: *shared
docker:
- image: library/ubuntu:jammy
ubuntu2310:
<<: *shared
docker:
- image: library/ubuntu:mantic
workflows:
build-deb:
jobs:
- debian11:
<<: *debian_only
- debian12:
<<: *debian_only
- debian13:
<<: *debian_only
- ubuntu2004:
<<: *debian_only
- ubuntu2204:
<<: *debian_only
- ubuntu2310:
<<: *debian_only
sfp-master-1.0.7/.github/ 0000775 0000000 0000000 00000000000 15060530456 0015144 5 ustar 00root root 0000000 0000000 sfp-master-1.0.7/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 15060530456 0017327 5 ustar 00root root 0000000 0000000 sfp-master-1.0.7/.github/ISSUE_TEMPLATE/Bug_report.yml 0000664 0000000 0000000 00000004150 15060530456 0022162 0 ustar 00root root 0000000 0000000 name: "Report bug"
description: "Create a bug report to help this project improve"
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
### Thank you for contributing to this project!
Before create a new bug report please search and check there isn't a duplicate already present.
- type: input
id: distribution
validations:
required: true
attributes:
label: Distribution
description: Provide the distribution and its version
value: For example Debian 12, Ubuntu 22.04, Fedora 37 etc...
- type: input
id: architecture
validations:
required: true
attributes:
label: Architecture
description: Provide the architecture
value: For example amd64, armhf, arm64 etc...
- type: input
id: kernel-version
validations:
required: false
attributes:
label: Kernel version
description: |
Provide the kernel version used, if from distribution also the package version.
Can be useful "uname -a" output
value: For example 5.15 from ubuntu package 5.15.0-56.62~20.04.1
- type: input
id: sfp-master-version
validations:
required: true
attributes:
label: SFP-Master version
description: |
Provide the SFP-Master version used
Please specify git commit used for build out of tagged version
value: For example version 1.1.6 or commit c763e58
- type: textarea
id: bug-description
validations:
required: true
attributes:
label: Bug description
description: |
Provide a description of the bug you're found.
Please don't expect anyone to guess everything but give enough information.
- type: textarea
id: reproduce
attributes:
label: Steps to reproduce
description: Describe the steps to reproduce the bug (when possible).
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: Describe what you expected to happen instead.
- type: textarea
id: additional-info
attributes:
label: Additional information
description: Add any additional information related to the issue here.
sfp-master-1.0.7/.github/ISSUE_TEMPLATE/Feature_request.yml 0000664 0000000 0000000 00000002170 15060530456 0023215 0 ustar 00root root 0000000 0000000 name: Feature request
description: Suggest a new feature or an improvement for this project
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
### Thank you for contributing to this project!
Before please search and check there isn't a duplicate already present.
- type: textarea
id: description
validations:
required: true
attributes:
label: Description
description: |
Provide a description of a feature request or an improvement that you want suggest.
- type: textarea
id: usage-tips
validations:
required: true
attributes:
label: Usage tips
description: |
Please keep this notes for other contributors
value: |
* Please use the 👠[reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to show that you are interested into this.
* Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this.
* Subscribe to receive notifications on status change and new comments, you can do also without add comment.
sfp-master-1.0.7/.github/dependabot.yml 0000664 0000000 0000000 00000000166 15060530456 0017777 0 ustar 00root root 0000000 0000000 version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
sfp-master-1.0.7/.github/workflows/ 0000775 0000000 0000000 00000000000 15060530456 0017201 5 ustar 00root root 0000000 0000000 sfp-master-1.0.7/.github/workflows/build.yml 0000664 0000000 0000000 00000005005 15060530456 0021023 0 ustar 00root root 0000000 0000000 name: Build
on:
push:
branches-ignore:
- "debian/**"
paths-ignore:
- "README.md"
- "**/README.md"
pull_request:
branches-ignore:
- "debian/**"
paths-ignore:
- "README.md"
- "**/README.md"
workflow_dispatch:
jobs:
amd64:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
name: [Ubuntu-20, Ubuntu-22, Debian-11, Debian-12, Debian-Testing, Debian-Experimental]
cpp_compiler: [g++]
include:
- name: Ubuntu-20
# Uses gcc 9.3.0, clang 10.0.0, cmake 3.16.3
image: "ubuntu:20.04"
ubuntu: 20
- name: Ubuntu-22
# Uses gcc 12.2.0, clang 15.0.7, cmake 3.24.2
image: "ubuntu:22.04"
ubuntu: 22
- name: Debian-11
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
image: "debian:bullseye"
- name: Debian-11
image: "debian:bullseye"
c_compiler: clang
cpp_compiler: clang++
- name: Debian-12
# Uses gcc 12.2.0, clang 15.0.6, cmake 3.25.1
image: "debian:bookworm"
- name: Debian-12
image: "debian:bookworm"
c_compiler: clang
cpp_compiler: clang++
- name: Debian-Testing
image: "debian:testing"
- name: Debian-Testing
image: "debian:testing"
c_compiler: clang
cpp_compiler: clang++
- name: Debian-Experimental
image: "debian:experimental"
- name: Debian-Experimental
image: "debian:experimental"
c_compiler: clang
cpp_compiler: clang++
container:
image: ${{ matrix.image }}
env:
LANG: en_US.UTF-8
BUILD_TYPE: ${{ matrix.build_type }}
CC: ${{ matrix.c_compiler }}
CXX: ${{ matrix.cpp_compiler }}
WITH_PROJ: ON
APT_LISTCHANGES_FRONTEND: none
DEBIAN_FRONTEND: noninteractive
steps:
- name: Install packages required
shell: bash
run: |
apt-get update -qq
apt-get install -yq \
clang \
cmake \
g++ \
libusb-1.0-0-dev \
qtbase5-dev \
qttools5-dev \
pkg-config
apt-get satisfy "systemd-dev (>= 253-2~) | udev (<< 253-2~)" --yes
- uses: actions/checkout@v5
- name: Build
working-directory: .
run: |
cmake .
make
make install
sfp-master-1.0.7/.github/workflows/codespell.yml 0000664 0000000 0000000 00000000771 15060530456 0021703 0 ustar 00root root 0000000 0000000 name: Codespell
on: [pull_request]
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: codespell
uses: codespell-project/actions-codespell@v2
with:
# only show the typo detected but don't make workflow to fail
only_warn: 1
skip: "*.ts"
# word to exclude must be always lowercase as must be same of the codespell dictionary
ignore_words_list: ba
sfp-master-1.0.7/.gitignore 0000664 0000000 0000000 00000000416 15060530456 0015575 0 ustar 00root root 0000000 0000000 # Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
sfp-master-1.0.7/CMakeLists.txt 0000664 0000000 0000000 00000013615 15060530456 0016352 0 ustar 00root root 0000000 0000000 cmake_minimum_required(VERSION 3.10.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
project(SFP-Master LANGUAGES C CXX)
# Set the CMAKE_INSTALL_PREFIX to /usr if not specified
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "The default install prefix on macOS" FORCE)
# Set Qt5 path for macOS
set(CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}/opt/qt@5" CACHE PATH "Path to Qt5 on macOS" FORCE)
else()
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "The default install prefix" FORCE)
endif()
endif()
# Set the CMAKE_INSTALL_BINDIR to /bin if not specified
if(NOT DEFINED CMAKE_INSTALL_BINDIR)
set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
endif()
# Set the CMAKE_INSTALL_DATAROOTDIR to /share if not specified
if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR)
set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)")
endif()
# Set the CMAKE_INSTALL_LIBDIR to /lib if not specified
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR "/lib" CACHE PATH "read-only single-machine data (lib)")
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(Qt6 QUIET COMPONENTS Core Widgets)
if (TARGET Qt6::Core AND TARGET Qt6::Widgets)
set(QT_VERSION_MAJOR 6)
find_package(Qt6LinguistTools REQUIRED)
else()
# If QT6 not found, using QT5
find_package(Qt5 REQUIRED COMPONENTS Core Widgets LinguistTools)
set(QT_VERSION_MAJOR 5)
endif()
find_package(LibUSB REQUIRED)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(UDEVDIR "/usr/lib/udev")
if (CMAKE_INSTALL_PREFIX STREQUAL "/usr" OR CMAKE_INSTALL_PREFIX STREQUAL "/" )
# /usr and / install prefixes at treated by cmake GNUInstallDirs as
# synonym for "system location". In this case we can look up the correct udevdir
# using pkg-config.
# See: https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html#special-cases
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules( PKGCONFIG_UDEV udev)
if (PKGCONFIG_UDEV_FOUND)
execute_process(
COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=udevdir udev
OUTPUT_VARIABLE PKGCONFIG_UDEVDIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(PKGCONFIG_UDEVDIR)
file(TO_CMAKE_PATH "${PKGCONFIG_UDEVDIR}" UDEVDIR)
endif()
endif()
endif()
endif()
endif()
# Translation files
set(TS_FILES
language/SFP-Master_hu_HU.ts
language/SFP-Master_ru_RU.ts
language/SFP-Master_it_IT.ts
language/SFP-Master_pt_BR.ts
language/SFP-Master_de_DE.ts
)
if (QT_VERSION_MAJOR EQUAL 5)
qt5_add_translation(QM_FILES ${TS_FILES})
else()
qt_add_translation(QM_FILES ${TS_FILES})
endif()
add_custom_target(translations DEPENDS ${QM_FILES})
add_executable(${PROJECT_NAME}
main.cpp
mainwindow.cpp
qhexedit.cpp
chunks.cpp
commands.cpp
dialogabout.cpp
dialogpass.cpp
ch341funcs.c
mainwindow.h
qhexedit.h
chunks.h
commands.h
dialogpass.h
ch341eeprom.h
dialogabout.h
mainwindow.ui
resource.qrc
${QM_FILES}
)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
if (QT_VERSION_MAJOR EQUAL 5)
target_link_libraries(${PROJECT_NAME} Qt5::Core)
target_link_libraries(${PROJECT_NAME} Qt5::Widgets ${LibUSB_LIBRARIES})
else()
target_link_libraries(${PROJECT_NAME} Qt::Core)
target_link_libraries(${PROJECT_NAME} Qt::Widgets ${LibUSB_LIBRARIES})
endif()
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/img/SFP-Master.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pixmaps")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/other/SFP-Master.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/other/SFP-Master.1.gz" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/man/man1")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/other/io.github.bigbigmdm.sfp-master.metainfo.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/other/index.html" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/sfp-master/html")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/img/screenshot.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/sfp-master/html")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/img/my_sfp_adapter_sch.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/sfp-master/html")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/img/my_sfp_adapter_3d.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/sfp-master/html")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/img/connection.jpg" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/sfp-master/html")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/img/undo64.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/sfp-master/html")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/img/redo64.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/sfp-master/html")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/img/read64.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/sfp-master/html")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/img/write64.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/sfp-master/html")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/img/password64.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/sfp-master/html")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/img/save64.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/sfp-master/html")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/img/open64.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/sfp-master/html")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/img/exit64.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/sfp-master/html")
install(FILES ${QM_FILES} DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/sfp-master")
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/other/70-CH341.rules" DESTINATION "${UDEVDIR}/rules.d")
endif()
sfp-master-1.0.7/ChangeLog 0000664 0000000 0000000 00000000730 15060530456 0015356 0 ustar 00root root 0000000 0000000 - Ver. 1.0.1 - Initial release
- Ver. 1.0.2 - Added Italian translation by Giovanni Scafora.
Fix errors in RPM spec file. Added changelog file.
- Ver. 1.0.3 - Added Hungarian translation by Charles K Barcza.
Fixed minor bugs in the main interface.
- Ver. 1.0.4 - Optimization for Ubuntu and Debian.
- Ver. 1.0.5 - Added German translation by wucke13
Fixed minor bugs in the main interface.
- Ver. 1.0.6 - Fixed memory leaks.
- Ver. 1.0.7 - Ported from QT5 to QT6.
sfp-master-1.0.7/LICENSE 0000664 0000000 0000000 00000104515 15060530456 0014617 0 ustar 00root root 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
sfp-master-1.0.7/QHexEditPlugin.cpp 0000664 0000000 0000000 00000003265 15060530456 0017150 0 ustar 00root root 0000000 0000000 #include "QHexEditPlugin.h"
#include "qhexedit.h"
#include
QHexEditPlugin::QHexEditPlugin(QObject * parent) : QObject(parent)
{
initialized = false;
}
bool QHexEditPlugin::isContainer() const
{
return false;
}
bool QHexEditPlugin::isInitialized() const
{
return initialized;
}
QIcon QHexEditPlugin::icon() const
{
return QIcon();
}
QString QHexEditPlugin::domXml() const
{
return "\n"
" \n"
" \n"
" \n"
" 0\n"
" 0\n"
" 100\n"
" 100\n"
" \n"
" \n"
" \n"
" QHexEditWidget\n"
" \n"
" \n"
" QHexEdit widget allow to edit the data in hex view.\n"
" \n"
" \n"
"\n";
}
QString QHexEditPlugin::group() const
{
return "Input Widgets";
}
QString QHexEditPlugin::includeFile() const
{
return "qhexedit.h";
}
QString QHexEditPlugin::name() const
{
return "QHexEdit";
}
QString QHexEditPlugin::toolTip() const
{
return "";
}
QString QHexEditPlugin::whatsThis() const
{
return "";
}
QWidget * QHexEditPlugin::createWidget(QWidget *parent)
{
return new QHexEdit(parent);
}
void QHexEditPlugin::initialize(QDesignerFormEditorInterface * /*core*/)
{
if (initialized)
return;
initialized = true;
}
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
Q_EXPORT_PLUGIN2(QHexEditPlugin, QHexEditPlugin)
#endif
sfp-master-1.0.7/QHexEditPlugin.h 0000664 0000000 0000000 00000001642 15060530456 0016612 0 ustar 00root root 0000000 0000000 #ifndef QHEXEDITPLUGIN_H
#define QHEXEDITPLUGIN_H
#include
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
#include
#else
#include
#endif
class QHexEditPlugin : public QObject, public QDesignerCustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
Q_PLUGIN_METADATA(IID "com.qt-project.Qt.QHexEditPlugin")
#endif
public:
QHexEditPlugin(QObject * parent = 0);
bool isContainer() const;
bool isInitialized() const;
QIcon icon() const;
QString domXml() const;
QString group() const;
QString includeFile() const;
QString name() const;
QString toolTip() const;
QString whatsThis() const;
QWidget *createWidget(QWidget *parent);
void initialize(QDesignerFormEditorInterface *core);
private:
bool initialized;
};
#endif
sfp-master-1.0.7/README.md 0000664 0000000 0000000 00000014347 15060530456 0015074 0 ustar 00root root 0000000 0000000 # SFP-Master
* [Installing in Linux](#installing-in-Linux)
* [Connection](#connection)
* [How to use](#how-to-use)
* [Packages](#packages)
* [Changelog](ChangeLog)
* [Licensing](#Licensing)
* [Translations](#Translations)
SFP-module data programmer for CH341a devices

**SFP-Master** is a free software programmer of optical `SFP modules` for CH341a
devices. It can be used to read, write and save SFP module data to the computer.
The SFP-Master makes respect to [QHexEdit2](https://github.com/Simsys/qhexedit2)
hex editor and [ch341prog](https://github.com/setarcos/ch341prog).
SFP-Master requires an SFP to I2C adapter. This adapter is used to read and
program SFP-module data. It must be inserted into the slot labelled `24xxx` of
the CH341a programmer.


- See more details [here](https://github.com/bigbigmdm/Tools_for_CH341A_programmer?tab=readme-ov-file#Homemade-Chip-adapters).
The OSHWLAB project of this adapter is [here](https://oshwlab.com/einkreader/ch341a_sfp_adapter).
Jumpers J1 to J3 (TxPWR, RxPWR, TxEN) must be installed initially. They are used
to supply power to the SFP module. If you want to program a module with
hardware write protection, remove one of the jumpers and try to program
the module.
If it fails, remove the other jumper and repeat the operation.
# Installing in Linux
For build are needed:
- g++ or clang
- CMake
- libusb 1.0
- Qt5 or QT6
- Qt5 Qt5LinguistTools or QT6 Qt5LinguistTools
- pkgconf or pkg-config
- udev
On Debian and derivatives for QT5 version:
`sudo apt-get install cmake g++ libusb-1.0-0-dev pkgconf qtbase5-dev qttools5-dev`
On Debian and derivatives for QT6 version:
`sudo apt-get install cmake g++ libusb-1.0-0-dev pkgconf qt6-base-dev
qt6-tools-dev linguist-qt6 qt6-l10n-tools qt6-tools-dev-tools`
On Debian >=13 and Ubuntu >=23.10:
`sudo apt-get install systemd-dev`
On older:
`sudo apt-get install udev`
To build and install the SFP-Master enter:
`sudo ./build_all.sh`
To uninstall, enter:
`sudo ./uninstall.sh`
### [Install](https://hu.blackpanther.hu/alkalmazas-letoltes/sfp-modul-olvaso-iro-mester-flasher/) to blackPanther OS
`installing sfp-master`
# Connection
To work with the programmer, connect the SFP module to the connector in the SFP
adapter, connect the SFP adapter to the CH341A programmer device to the slot
marked `24xx`. Connect the CH341A Programmer Unit to the USB connector of the
computer and start the `SFP-Master` program.

# How to use
The hexadecimal chip editor (right side of the screen) is used to display and
modify buffer data.
It contains the following controls: `Hex-Editor / Undo` or 
or `` undo and
`Hex-Editor / Redo` or  or `` redo.
- Pressing `SFP-module / Read from SFP` or  or ``
to read data from the SFP-module into the computer buffer.
- Pressing `SFP-module / Write to SFP` or  or ``
to write data from the
computer buffer into the SFP-module.
- Press `SFP Module / Set Module Password` or  or
`` to bring up
the password setting menu for modules that are password protected.
- The checkboxes are used to select the address area for read, write or save
procedures:
| Checkbox colour | SFP-Master address | Real SFP address |
| :--- | :---: | :---: |
| Green (Always on) | 0x0000 - 0x007F | 0xA000 - 0xA07F |
| Blue | 0x0080 - 0x00FF | 0xA080 - 0xA0FF |
| Red | 0x0100 - 0x017F | 0xA200 - 0xA27F |
| Yellow | 0x0180 - 0x01FF | 0xA280 - 0xA2FF |
The `Parse` button is used to re-parse hexadecimal data in the hex editor, if
they have been changed manually.
The `Checksum` button is used to calculate two checksums (addresses 0x03F and
0x05F according to SFF-8472 Rev 12.3),
if the module data have been changed manually in the hex editor.
Changing the data on the left side of the screen automatically causes the data
to be changed in the hex editor.
- The `File / Save` or  or `` button is used to
save the computer buffer to a file.
- The `File / Open` or  or `` button is used to
save the file in the computer buffer.
- The `File / Exit` or  or `` button is used to
close the program.
## Packages
- For some versions of Fedora, you can use the COPR repositories.
```
sudo dnf install dnf-plugins-core
sudo dnf copr enable bigmdm/sfp-master
sudo dnf install sfp-master
```
- For some versions of UBUNTU, you can use the Launchpad repositories.
```
sudo add-apt-repository ppa:bigmdm/sfp-master
sudo apt update
sudo apt install sfp-master
```
- The `ARCH AUR repository` by [Giovanni Scafora](https://github.com/giovanni69) is [here](https://aur.archlinux.org/packages/sfp-master-git)
- The Windows release by [Anime4000](https://github.com/Anime4000) is [here](https://github.com/Anime4000/SFP-Master/releases)
## Licensing
Copyright (C) 2024 - 2025 Mikhail Medvedev.
This project and [ch341prog](https://github.com/setarcos/ch341prog) use
[GPL-3+ License](https://www.gnu.org/licenses/gpl-3.0.html),
some parts taken from project [QHexEdit2](https://github.com/Simsys/qhexedit2)
is [LGPL-2.1](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html).
## Translations
- Italian translation by [Giovanni Scafora](https://github.com/giovanni69)
- Hungarian translation by [Charles K Barcza](https://github.com/blackPantherOS)
- Brasil translation by [Alexandre C. Leite](https://github.com/alexandrecleite)
- German translation by [Wucke13](https://github.com/wucke13)
Anyone can add or improve a translation by making a pull request.
Translations files are located in:
[language/](https://github.com/bigbigmdm/SFP-Master/tree/main/language)
You can also add translation to the desktop file ([SFP-Master.desktop](https://github.com/bigbigmdm/SFP-Master/blob/main/other/SFP-Master.desktop)).
sfp-master-1.0.7/SFP-master.pro 0000664 0000000 0000000 00000003314 15060530456 0016250 0 ustar 00root root 0000000 0000000 #-------------------------------------------------
#
# Project created by QtCreator 2024-10-22T13:19:36
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
LIBS += -lusb-1.0
TARGET = SFP-master
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
CONFIG += c++11
SOURCES += \
main.cpp \
mainwindow.cpp \
chunks.cpp \
qhexedit.cpp \
commands.cpp \
ch341funcs.c \
dialogabout.cpp \
dialogpass.cpp
HEADERS += \
mainwindow.h \
chunks.h \
mainwindow.h \
commands.h \
qhexedit.h \
ch341eeprom.h \
dialogabout.h \
dialogpass.h
FORMS += \
mainwindow.ui \
dialogabout.ui \
dialogpass.ui
TRANSLATIONS += language/SFP-Master_hu_HU.ts \
language/SFP-Master_ru_RU.ts \
language/SFP-Master_it_IT.ts \
language/SFP-Master_pt_BR.ts \
language/SFP-Master_de_DE.ts
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
resource.qrc
sfp-master-1.0.7/build_all.sh 0000775 0000000 0000000 00000000764 15060530456 0016101 0 ustar 00root root 0000000 0000000 #!/bin/bash
if [[ "$EUID" -ne 0 ]] && [[ "$OSTYPE" != "darwin"* ]]
then echo "Please run as root! (sudo ./build_all.sh)"
exit
fi
[[ "$OSTYPE" == "darwin"* ]] && export C_INCLUDE_PATH=/usr/local/opt/libusb/include
(
rm -rf build/
mkdir build/
cmake -S . -B build/
cmake --build build/ --parallel
cmake --install build/
rm -rf build/
)
# Reloading the USB rules or creating the app bundles for macOS
[[ "$OSTYPE" != "darwin"* ]] && udevadm control --reload-rules || ./create_macos_appbundles.sh
sfp-master-1.0.7/ch341eeprom.h 0000664 0000000 0000000 00000052167 15060530456 0016022 0 ustar 00root root 0000000 0000000 // libUSB driver for the ch341a in i2c mode
//
// Copyright 2011 asbokid
// Copyright 2024 Mikhail Medvedev
#include
#include
#define MAX_EEPROM_SIZE 131072 /* For 24c1024*/
#define EEPROM_I2C_BUS_ADDRESS 0x50
#define BULK_WRITE_ENDPOINT 0x02 /* bEndpointAddress 0x02 EP 2 OUT (Bulk)*/
#define BULK_READ_ENDPOINT 0x82 /* bEndpointAddress 0x82 EP 2 IN (Bulk)*/
#define DEFAULT_INTERFACE 0x00
#define DEFAULT_CONFIGURATION 0x01
#define DEFAULT_TIMEOUT 300 // 300mS for USB timeouts
#define IN_BUF_SZ 0x100
#define EEPROM_WRITE_BUF_SZ 0x2b // only for 24c64 / 24c32 ??
#define EEPROM_READ_BULKIN_BUF_SZ 0x20
#define EEPROM_READ_BULKOUT_BUF_SZ 0x65
/* Based on (closed-source) DLL V1.9 for USB by WinChipHead (c) 2005.
Supports USB chips: CH341, CH341A
This can be a problem for copyright, sure asbokid can't release this part on any GPL licence*/
#define mCH341_PACKET_LENGTH 32 /* wMaxPacketSize 0x0020 1x 32 bytes, unused on the source*/
#define mCH341_PKT_LEN_SHORT 8 /* wMaxPacketSize 0x0008 1x 8 bytes, unused on the source*/
#define mCH341_ENDP_INTER_UP 0x81 /* bEndpointAddress 0x81 EP 1 IN (Interrupt), unused on the source*/
#define mCH341_ENDP_INTER_DOWN 0x01 /* This endpoint isn't list on my lsusb -v output, unused on the source*/
#define mCH341_ENDP_DATA_UP 0x82 /* ==BULK_READ_ENDPOINT Why repeat it?*/
#define mCH341_ENDP_DATA_DOWN 0x02 /* ==BULK_WRITE_ENDPOINT Why repeat it?*/
#define mCH341_VENDOR_READ 0xC0 /* Unused on the source*/
#define mCH341_VENDOR_WRITE 0x40 /* Unused on the source*/
#define mCH341_PARA_INIT 0xB1 /* Unused on the source*/
#define mCH341_I2C_STATUS 0x52 /* Unused on the source*/
#define mCH341_I2C_COMMAND 0x53 /* Unused on the source*/
#define mCH341_PARA_CMD_R0 0xAC /* Unused on the source*/
#define mCH341_PARA_CMD_R1 0xAD /* Unused on the source*/
#define mCH341_PARA_CMD_W0 0xA6 /* Unused on the source*/
#define mCH341_PARA_CMD_W1 0xA7 /* Unused on the source*/
#define mCH341_PARA_CMD_STS 0xA0 /* Unused on the source*/
#define mCH341A_CMD_SET_OUTPUT 0xA1 /* Unused on the source*/
#define mCH341A_CMD_IO_ADDR 0xA2 /* Unused on the source*/
#define mCH341A_CMD_PRINT_OUT 0xA3 /* Unused on the source*/
#define mCH341A_CMD_SPI_STREAM 0xA8 /* Unused on the source*/
#define mCH341A_CMD_SIO_STREAM 0xA9 /* Unused on the source*/
#define mCH341A_CMD_I2C_STREAM 0xAA
#define mCH341A_CMD_UIO_STREAM 0xAB /* Unused on the source*/
#define mCH341A_BUF_CLEAR 0xB2 /* Unused on the source*/
#define mCH341A_I2C_CMD_X 0x54 /* Unused on the source*/
#define mCH341A_DELAY_MS 0x5E /* Unused on the source*/
#define mCH341A_GET_VER 0x5F /* Unused on the source*/
#define mCH341_EPP_IO_MAX ( mCH341_PACKET_LENGTH - 1 ) /* Unused on the source*/
#define mCH341A_EPP_IO_MAX 0xFF /* Unused on the source*/
#define mCH341A_CMD_IO_ADDR_W 0x00 /* Unused on the source*/
#define mCH341A_CMD_IO_ADDR_R 0x80 /* Unused on the source*/
#define mCH341A_CMD_I2C_STM_STA 0x74
#define mCH341A_CMD_I2C_STM_STO 0x75
#define mCH341A_CMD_I2C_STM_OUT 0x80
#define mCH341A_CMD_I2C_STM_IN 0xC0
#define mCH341A_CMD_I2C_STM_MAX ( min( 0x3F, mCH341_PACKET_LENGTH ) ) /* Unused on the source*/
#define mCH341A_CMD_I2C_STM_SET 0x60
#define mCH341A_CMD_I2C_STM_US 0x40 /* Unused on the source*/
#define mCH341A_CMD_I2C_STM_MS 0x50 /* Unused on the source*/
#define mCH341A_CMD_I2C_STM_DLY 0x0F /* Unused on the source*/
#define mCH341A_CMD_I2C_STM_END 0x00
#define mCH341A_CMD_UIO_STM_IN 0x00 /* Unused on the source*/
#define mCH341A_CMD_UIO_STM_DIR 0x40 /* Unused on the source*/
#define mCH341A_CMD_UIO_STM_OUT 0x80 /* Unused on the source*/
#define mCH341A_CMD_UIO_STM_US 0xC0 /* Unused on the source*/
#define mCH341A_CMD_UIO_STM_END 0x20 /* Unused on the source*/
#define mCH341_PARA_MODE_EPP 0x00 /* Unused on the source*/
#define mCH341_PARA_MODE_EPP17 0x00 /* Unused on the source*/
#define mCH341_PARA_MODE_EPP19 0x01 /* Unused on the source*/
#define mCH341_PARA_MODE_MEM 0x02 /* Unused on the source*/
/* End of part based on (closed-source) DLL V1.9 for USB by WinChipHead (c) 2005.
Since is largely unused we can replace it */
#define CH341_I2C_LOW_SPEED 0 // low speed - 20kHz
#define CH341_I2C_STANDARD_SPEED 1 // standard speed - 100kHz
#define CH341_I2C_FAST_SPEED 2 // fast speed - 400kHz
#define CH341_I2C_HIGH_SPEED 3 // high speed - 750kHz
#define CH341_EEPROM_READ_CMD_SZ 0x65 /* Same size for all 24cXX read setup and next packets*/
/* CH341a READ EEPROM setup packet for the 24c01
this needs putting into a struct to allow convenient access to individual elements*/
#define CH341_EEPROM_24c01_READ_SETUP_CMD "\xaa\x74\x82\xa0\x00\x74\x81\xa1\xe0\x00\x0f\x00\x06\x04\x00\x00" \
"\x00\x00\x00\x00\x01\x00\x00\x00\x11\x4d\x40\x77\xcd\xab\xba\xdc" \
"\xaa\xe0\x00\x00\xc4\xf1\x12\x00\x11\x4d\x40\x77\xf0\xf1\x12\x00" \
"\xd9\x8b\x41\x7e\x00\xd0\xfd\x7f\xf0\xf1\x12\x00\x5a\x88\x41\x7e" \
"\xaa\xe0\x00\x00\x2a\x88\x41\x7e\x06\x04\x00\x00\x11\x4d\x40\x77" \
"\xe8\xf3\x12\x00\x14\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00" \
"\xaa\xdf\xc0\x75\x00"
/* please se file /wiresharkusbsniffing/sniffed.txt
this is the read setup packet for 24c01
0040 aa 74 82 a0 00 74 81 a1 e0 00 0f 00 06 04 00 00 .t...t.. ........
0050 00 00 00 00 01 00 00 00 11 4d 40 77 cd ab ba dc ........ .M@w....
0060 aa e0 00 00 c4 f1 12 00 11 4d 40 77 f0 f1 12 00 ........ .M@w....
0070 d9 8b 41 7e 00 d0 fd 7f f0 f1 12 00 5a 88 41 7e ..A~.... ....Z.A~
0080 aa e0 00 00 2a 88 41 7e 06 04 00 00 11 4d 40 77 ....*.A~ .....M@w
0090 e8 f3 12 00 14 00 00 00 01 00 00 00 00 00 00 00 ........ ........
00a0 aa df c0 75 00 ...u.
*/
/* CH341a READ EEPROM next packet for 24c01 (no packets!!!)*/
/* CH341a READ EEPROM setup packet for the 24c02
this needs putting into a struct to allow convenient access to individual elements*/
#define CH341_EEPROM_24c02_READ_SETUP_CMD "\xaa\x74\x82\xa0\x00\x74\x81\xa1\xe0\x00\x10\x00\x06\x04\x00\x00" \
"\x00\x00\x00\x00\x02\x00\x00\x00\x11\x4d\x40\x77\xcd\xab\xba\xdc" \
"\xaa\xe0\x00\x00\xc4\xf1\x12\x00\x11\x4d\x40\x77\xf0\xf1\x12\x00" \
"\xd9\x8b\x41\x7e\x00\xf0\xfd\x7f\xf0\xf1\x12\x00\x5a\x88\x41\x7e" \
"\xaa\xe0\x00\x00\x2a\x88\x41\x7e\x06\x04\x00\x00\x11\x4d\x40\x77" \
"\xe8\xf3\x12\x00\x14\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00" \
"\xaa\xdf\xc0\x75\x00"
/* please se file /wiresharkusbsniffing/sniffed.txt
this is the read setup packet for 24c02
0040 aa 74 82 a0 00 74 81 a1 e0 00 10 00 06 04 00 00 .t...t.. ........
0050 00 00 00 00 02 00 00 00 11 4d 40 77 cd ab ba dc ........ .M@w....
0060 aa e0 00 00 c4 f1 12 00 11 4d 40 77 f0 f1 12 00 ........ .M@w....
0070 d9 8b 41 7e 00 f0 fd 7f f0 f1 12 00 5a 88 41 7e ..A~.... ....Z.A~
0080 aa e0 00 00 2a 88 41 7e 06 04 00 00 11 4d 40 77 ....*.A~ .....M@w
0090 e8 f3 12 00 14 00 00 00 01 00 00 00 00 00 00 00 ........ ........
00a0 aa df c0 75 00 ...u.
*/
/* CH341a READ EEPROM next packet for 24c02 (one packet)*/
#define CH341_EEPROM_24c02_READ_NEXT_CMD "\xaa\x74\x82\xa0\x80\x74\x81\xa1\xe0\x00\x00\x00\x10\x00\x00\x00" \
"\x00\x00\x00\x00\x8c\xf1\x12\x00\x01\x00\x00\x00\x00\x00\x00\x00" \
"\xaa\xe0\x00\x00\x4c\xf1\x12\x00\x5d\x22\xd7\x5a\xdc\xf1\x12\x00" \
"\x8f\x04\x44\x7e\x30\x88\x41\x7e\xff\xff\xff\xff\x2a\x88\x41\x7e" \
"\xaa\xe0\x00\x7e\x00\x00\x00\x00\x69\x0e\x3c\x00\xe4\x00\x18\x00" \
"\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8c\xe8\x67\x00" \
"\xaa\xdf\xc0\x75\x00"
/*please see file /wiresharkusbsniffing/sniffed.txt
this is the read next packet for 24c02 (one packet)
0040 aa 74 82 a0 80 74 81 a1 e0 00 00 00 10 00 00 00 .t...t.. ........
0050 00 00 00 00 8c f1 12 00 01 00 00 00 00 00 00 00 ........ ........
0060 aa e0 00 00 4c f1 12 00 5d 22 d7 5a dc f1 12 00 ....L... ]".Z....
0070 8f 04 44 7e 30 88 41 7e ff ff ff ff 2a 88 41 7e ..D~0.A~ ....*.A~
0080 aa e0 00 7e 00 00 00 00 69 0e 3c 00 e4 00 18 00 ...~.... i.<.....
0090 0f 00 00 00 00 00 00 00 00 00 00 00 8c e8 67 00 ........ ......g.
00a0 aa df c0 75 00 ...u.
*/
/* CH341a READ EEPROM setup packet for the 24c04
this needs putting into a struct to allow convenient access to individual elements*/
#define CH341_EEPROM_24c04_READ_SETUP_CMD "\xaa\x74\x82\xa0\x00\x74\x81\xa1\xe0\x00\x11\x00\x06\x04\x00\x00" \
"\x00\x00\x00\x00\x04\x00\x00\x00\x11\x4d\x40\x77\xcd\xab\xba\xdc" \
"\xaa\xe0\x00\x00\xc4\xf1\x12\x00\x11\x4d\x40\x77\xf0\xf1\x12\x00" \
"\xd9\x8b\x41\x7e\x00\xd0\xfd\x7f\xf0\xf1\x12\x00\x5a\x88\x41\x7e" \
"\xaa\xe0\x00\x00\x2a\x88\x41\x7e\x06\x04\x00\x00\x11\x4d\x40\x77" \
"\xe8\xf3\x12\x00\x14\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00" \
"\xaa\xdf\xc0\x75\x00"
/* please se file /wiresharkusbsniffing/sniffed.txt
this is the read setup packet for 24c04
0040 aa 74 82 a0 00 74 81 a1 e0 00 11 00 06 04 00 00 .t...t.. ........
0050 00 00 00 00 04 00 00 00 11 4d 40 77 cd ab ba dc ........ .M@w....
0060 aa e0 00 00 c4 f1 12 00 11 4d 40 77 f0 f1 12 00 ........ .M@w....
0070 d9 8b 41 7e 00 d0 fd 7f f0 f1 12 00 5a 88 41 7e ..A~.... ....Z.A~
0080 aa e0 00 00 2a 88 41 7e 06 04 00 00 11 4d 40 77 ....*.A~ .....M@w
0090 e8 f3 12 00 14 00 00 00 01 00 00 00 00 00 00 00 ........ ........
00a0 aa df c0 75 00 ...u.
*/
/* CH341a READ EEPROM next packet for 24c04 (three packets)*/
#define CH341_EEPROM_24c04_READ_NEXT_CMD "\xaa\x74\x82\xa0\x80\x74\x81\xa1\xe0\x00\x00\x00\x10\x00\x00\x00" \
"\x00\x00\x00\x00\x8c\xf1\x12\x00\x01\x00\x00\x00\x00\x00\x00\x00" \
"\xaa\xe0\x00\x00\x4c\xf1\x12\x00\x5d\x22\xd7\x5a\xdc\xf1\x12\x00" \
"\x8f\x04\x44\x7e\x30\x88\x41\x7e\xff\xff\xff\xff\x2a\x88\x41\x7e" \
"\xaa\xe0\x00\x7e\x00\x00\x00\x00\x69\x0e\x3c\x00\xde\x00\x16\x00" \
"\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8c\xe8\x67\x00" \
"\xaa\xdf\xc0\x75\x00"
/*please see file /wiresharkusbsniffing/sniffed.txt
this is the first read next packet for 24c04 (three different packets)
0040 aa 74 82 a0 80 74 81 a1 e0 00 00 00 10 00 00 00 .t...t.. ........
0050 00 00 00 00 8c f1 12 00 01 00 00 00 00 00 00 00 ........ ........
0060 aa e0 00 00 4c f1 12 00 5d 22 d7 5a dc f1 12 00 ....L... ]".Z....
0070 8f 04 44 7e 30 88 41 7e ff ff ff ff 2a 88 41 7e ..D~0.A~ ....*.A~
0080 aa e0 00 7e 00 00 00 00 69 0e 3c 00 de 00 16 00 ...~.... i.<.....
0090 0f 00 00 00 00 00 00 00 00 00 00 00 8c e8 67 00 ........ ......g.
00a0 aa df c0 75 00 ...u.
*/
/* CH341a READ EEPROM setup packet for the 24c08
this needs putting into a struct to allow convenient access to individual elements*/
#define CH341_EEPROM_24c08_READ_SETUP_CMD "\xaa\x74\x82\xa0\x00\x74\x81\xa1\xe0\x00\x16\x00\x06\x04\x00\x00" \
"\x00\x00\x00\x00\x08\x00\x00\x00\x11\x4d\x40\x77\xcd\xab\xba\xdc" \
"\xaa\xe0\x00\x00\xc4\xf1\x12\x00\x11\x4d\x40\x77\xf0\xf1\x12\x00" \
"\xd9\x8b\x41\x7e\x00\xd0\xfd\x7f\xf0\xf1\x12\x00\x5a\x88\x41\x7e" \
"\xaa\xe0\x00\x00\x2a\x88\x41\x7e\x06\x04\x00\x00\x11\x4d\x40\x77" \
"\xe8\xf3\x12\x00\x14\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00" \
"\xaa\xdf\xc0\x75\x00"
/* please se file /wiresharkusbsniffing/sniffed.txt
this is the read setup packet for 24c08
0040 aa 74 82 a0 00 74 81 a1 e0 00 16 00 06 04 00 00 .t...t.. ........
0050 00 00 00 00 08 00 00 00 11 4d 40 77 cd ab ba dc ........ .M@w....
0060 aa e0 00 00 c4 f1 12 00 11 4d 40 77 f0 f1 12 00 ........ .M@w....
0070 d9 8b 41 7e 00 d0 fd 7f f0 f1 12 00 5a 88 41 7e ..A~.... ....Z.A~
0080 aa e0 00 00 2a 88 41 7e 06 04 00 00 11 4d 40 77 ....*.A~ .....M@w
0090 e8 f3 12 00 14 00 00 00 01 00 00 00 00 00 00 00 ........ ........
00a0 aa df c0 75 00 ...u.
*/
/* CH341a READ EEPROM next packet for 24c08 (seven packets)*/
#define CH341_EEPROM_24c08_READ_NEXT_CMD "\xaa\x74\x82\xa0\x80\x74\x81\xa1\xe0\x00\x00\x00\x10\x00\x00\x00" \
"\x00\x00\x00\x00\x8c\xf1\x12\x00\x01\x00\x00\x00\x00\x00\x00\x00" \
"\xaa\xe0\x00\x00\x4c\xf1\x12\x00\x5d\x22\xd7\x5a\xdc\xf1\x12\x00" \
"\x8f\x04\x44\x7e\x30\x88\x41\x7e\xff\xff\xff\xff\x2a\x88\x41\x7e" \
"\xaa\xe0\x00\x7e\x00\x00\x00\x00\x69\x0e\x3c\x00\x00\x01\x1a\x00" \
"\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8c\xe8\x67\x00" \
"\xaa\xdf\xc0\x75\x00"
/*please see file /wiresharkusbsniffing/sniffed.txt
this is the first read next packet for 24c08 (seven different packets)
0040 aa 74 82 a0 80 74 81 a1 e0 00 00 00 10 00 00 00 .t...t.. ........
0050 00 00 00 00 8c f1 12 00 01 00 00 00 00 00 00 00 ........ ........
0060 aa e0 00 00 4c f1 12 00 5d 22 d7 5a dc f1 12 00 ....L... ]".Z....
0070 8f 04 44 7e 30 88 41 7e ff ff ff ff 2a 88 41 7e ..D~0.A~ ....*.A~
0080 aa e0 00 7e 00 00 00 00 69 0e 3c 00 00 01 1a 00 ...~.... i.<.....
0090 0f 00 00 00 00 00 00 00 00 00 00 00 8c e8 67 00 ........ ......g.
00a0 aa df c0 75 00 ...u.
*/
/* CH341a READ EEPROM setup packet for the 24c16
this needs putting into a struct to allow convenient access to individual elements*/
#define CH341_EEPROM_24c16_READ_SETUP_CMD "\xaa\x74\x82\xa0\x00\x74\x81\xa1\xe0\x00\x0e\x00\x06\x04\x00\x00" \
"\x00\x00\x00\x00\x10\x00\x00\x00\x11\x4d\x40\x77\xcd\xab\xba\xdc" \
"\xaa\xe0\x00\x00\xc4\xf1\x12\x00\x11\x4d\x40\x77\xf0\xf1\x12\x00" \
"\xd9\x8b\x41\x7e\x00\xe0\xfd\x7f\xf0\xf1\x12\x00\x5a\x88\x41\x7e" \
"\xaa\xe0\x00\x00\x2a\x88\x41\x7e\x06\x04\x00\x00\x11\x4d\x40\x77" \
"\xe8\xf3\x12\x00\x14\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00" \
"\xaa\xdf\xc0\x75\x00"
/* please se file /wiresharkusbsniffing/sniffed.txt
this is the read setup packet for 24c16
0040 aa 74 82 a0 00 74 81 a1 e0 00 0e 00 06 04 00 00 .t...t.. ........
0050 00 00 00 00 10 00 00 00 11 4d 40 77 cd ab ba dc ........ .M@w....
0060 aa e0 00 00 c4 f1 12 00 11 4d 40 77 f0 f1 12 00 ........ .M@w....
0070 d9 8b 41 7e 00 e0 fd 7f f0 f1 12 00 5a 88 41 7e ..A~.... ....Z.A~
0080 aa e0 00 00 2a 88 41 7e 06 04 00 00 11 4d 40 77 ....*.A~ .....M@w
0090 e8 f3 12 00 14 00 00 00 01 00 00 00 00 00 00 00 ........ ........
00a0 aa df c0 75 00 ...u.
*/
/* CH341a READ EEPROM next packet for 24c16*/
#define CH341_EEPROM_24c16_READ_NEXT_CMD "\xaa\x74\x82\xa0\x80\x74\x81\xa1\xe0\x00\x00\x00\x10\x00\x00\x00" \
"\x00\x00\x00\x00\x8c\xf1\x12\x00\x01\x00\x00\x00\x00\x00\x00\x00" \
"\xaa\xe0\x00\x00\x4c\xf1\x12\x00\x5d\x22\xd7\x5a\xdc\xf1\x12\x00" \
"\x8f\x04\x44\x7e\x30\x88\x41\x7e\xff\xff\xff\xff\x2a\x88\x41\x7e" \
"\xaa\xe0\x00\x7e\x00\x00\x00\x00\x69\x0e\x3c\x00\xfa\x00\x31\x00" \
"\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8c\xe8\x67\x00" \
"\xaa\xdf\xc0\x75\x00"
/*please see file /wiresharkusbsniffing/sniffed.txt
this is the first read next packet for 24c16 (fifteen different packets)
0040 aa 74 82 a0 80 74 81 a1 e0 00 00 00 10 00 00 00 .t...t.. ........
0050 00 00 00 00 8c f1 12 00 01 00 00 00 00 00 00 00 ........ ........
0060 aa e0 00 00 4c f1 12 00 5d 22 d7 5a dc f1 12 00 ....L... ]".Z....
0070 8f 04 44 7e 30 88 41 7e ff ff ff ff 2a 88 41 7e ..D~0.A~ ....*.A~
0080 aa e0 00 7e 00 00 00 00 69 0e 3c 00 fa 00 31 00 ...~.... i.<...1.
0090 0f 00 00 00 00 00 00 00 00 00 00 00 8c e8 67 00 ........ ......g.
00a0 aa df c0 75 00 ...u.
*/
/* CH341a READ EEPROM setup packet for the 24c64
this needs putting into a struct to allow convenient access to individual elements*/
#define CH341_EEPROM_24c64_READ_SETUP_CMD "\xaa\x74\x83\xa0\x00\x00\x74\x81\xa1\xe0\x00\x00\x06\x04\x00\x00" \
"\x00\x00\x00\x00\x40\x00\x00\x00\x11\x4d\x40\x77\xcd\xab\xba\xdc" \
"\xaa\xe0\x00\x00\xc4\xf1\x12\x00\x11\x4d\x40\x77\xf0\xf1\x12\x00" \
"\xd9\x8b\x41\x7e\x00\xf0\xfd\x7f\xf0\xf1\x12\x00\x5a\x88\x41\x7e" \
"\xaa\xe0\x00\x00\x2a\x88\x41\x7e\x06\x04\x00\x00\x11\x4d\x40\x77" \
"\xe8\xf3\x12\x00\x14\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00" \
"\xaa\xdf\xc0\x75\x00"
/* please se file /wiresharkusbsniffing/sniffed.txt
this is the read setup packet for 24c64
0040 aa 74 83 a0 00 00 74 81 a1 e0 00 00 06 04 00 00 .t....t. ........
0050 00 00 00 00 40 00 00 00 11 4d 40 77 cd ab ba dc ....@... .M@w....
0060 aa e0 00 00 c4 f1 12 00 11 4d 40 77 f0 f1 12 00 ........ .M@w....
0070 d9 8b 41 7e 00 e0 fd 7f f0 f1 12 00 5a 88 41 7e ..A~.... ....Z.A~
0080 aa e0 00 00 2a 88 41 7e 06 04 00 00 11 4d 40 77 ....*.A~ .....M@w
0090 e8 f3 12 00 14 00 00 00 01 00 00 00 00 00 00 00 ........ ........
00a0 aa df c0 75 00 ...u.
*/
/* CH341a READ EEPROM next packet for 24c64 (63 packets)*/
#define CH341_EEPROM_24c64_READ_NEXT_CMD "\xaa\x74\x83\xa0\x00\x00\x74\x81\xa1\xe0\x00\x00\x10\x00\x00\x00" \
"\x00\x00\x00\x00\x8c\xf1\x12\x00\x01\x00\x00\x00\x00\x00\x00\x00" \
"\xaa\xe0\x00\x00\x4c\xf1\x12\x00\x5d\x22\xd7\x5a\xdc\xf1\x12\x00" \
"\x8f\x04\x44\x7e\x30\x88\x41\x7e\xff\xff\xff\xff\x2a\x88\x41\x7e" \
"\xaa\xe0\x00\x7e\x00\x00\x00\x00\x69\x0e\x3c\x00\x12\x01\x19\x00" \
"\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9c\x2e\x68\x00" \
"\xaa\xdf\xc0\x75\x00"
/* please see file /wiresharkusbsniffing/sniffed.txt
this is the first read next packet for 24c64 (63 different packets)
0040 aa 74 83 a0 00 80 74 81 a1 e0 00 00 10 00 00 00 .t....t. ........
0050 00 00 00 00 8c f1 12 00 01 00 00 00 00 00 00 00 ........ ........
0060 aa e0 00 00 4c f1 12 00 5d 22 d7 5a dc f1 12 00 ....L... ]".Z....
0070 8f 04 44 7e 30 88 41 7e ff ff ff ff 2a 88 41 7e ..D~0.A~ ....*.A~
0080 aa e0 00 7e 00 00 00 00 69 0e 3c 00 3a 01 1b 00 ...~.... i.<.:...
0090 0f 00 00 00 00 00 00 00 00 00 00 00 8c e8 67 00 ........ ......g.
00a0 aa df c0 75 00 ...u.
*/
#define USB_LOCK_VENDOR 0x1a86
#define USB_LOCK_PRODUCT 0x5512
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
#define TRUE 1
#define FALSE 0
struct EEPROM {
char *name;
uint32_t size;
uint16_t page_size;
uint8_t addr_size; // Length of addres in bytes
uint8_t i2c_addr_mask;
};
int32_t ch341aConnect();
int32_t ch341aShutdown();
int32_t ch341readEEPROM_param(uint8_t *buffer, uint32_t offset, uint32_t bytestoread, uint32_t ic_size, uint32_t block_size, uint8_t algorithm);
int32_t ch341writeEEPROM_param(uint8_t *buffer, uint32_t offset, uint32_t bytesum, uint32_t block_size, uint8_t algorithm);
struct libusb_device_handle *ch341configure(uint16_t vid, uint16_t pid);
int32_t ch341setstream( uint32_t speed);
int32_t parseEEPsize(char *eepromname);
// callback functions for async USB transfers
void cbBulkIn(struct libusb_transfer *transfer);
void cbBulkOut(struct libusb_transfer *transfer);
sfp-master-1.0.7/ch341funcs.c 0000664 0000000 0000000 00000037655 15060530456 0015651 0 ustar 00root root 0000000 0000000 //
// ch341eeprom programmer version 0.1 (Beta)
//
// Programming tool for the 24Cxx serial EEPROMs using the Winchiphead CH341A IC
//
// (c) December 2011 asbokid
// (c) 2024 Mikhail Medvedev
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
#include
#include
#include
#include
#include
#include
#include
#include "ch341eeprom.h"
extern FILE *debugout, *verbout;
uint32_t getnextpkt; // set by the callback function
uint32_t syncackpkt; // synch / ack flag used by BULK OUT cb function
uint16_t byteoffset;
uint8_t *readbuf;
struct libusb_device_handle *devHandle;
// --------------------------------------------------------------------------
// ch341configure()
// lock USB device for exclusive use
// claim default interface
// set default configuration
// retrieve device descriptor
// identify device revision
// returns *usb device handle
struct libusb_device_handle *ch341configure(uint16_t vid, uint16_t pid) {
struct libusb_device *dev;
int32_t ret=0; // set to < 0 to indicate USB errors
uint32_t i = 0;
int32_t currentConfig = 0;
uint8_t ch341DescriptorBuffer[0x12];
uint8_t ch341InBuffer[IN_BUF_SZ]; // 0x100 bytes in size
uint8_t ch341OutBuffer[EEPROM_READ_BULKOUT_BUF_SZ];
ret = libusb_init(NULL);
if(ret < 0) {
printf("Couldnt initialise libusb\n");
return NULL;
}
//libusb_set_debug(NULL, 3); //deprecated
libusb_set_option(NULL, 3); // maximum debug logging level
printf( "Searching USB buses for WCH CH341a i2c EEPROM programmer [%04x:%04x]\n",
USB_LOCK_VENDOR, USB_LOCK_PRODUCT);
if(!(devHandle = libusb_open_device_with_vid_pid(NULL, USB_LOCK_VENDOR, USB_LOCK_PRODUCT))) {
printf("Couldn't open device [%04x:%04x]\n", USB_LOCK_VENDOR, USB_LOCK_PRODUCT);
return NULL;
}
if(!(dev = libusb_get_device(devHandle))) {
printf("Couldnt get bus number and address of device\n");
return NULL;
}
printf("Found [%04x:%04x] as device [%d] on USB bus [%d]\n", USB_LOCK_VENDOR, USB_LOCK_PRODUCT,
libusb_get_device_address(dev), libusb_get_bus_number(dev));
printf("Opened device [%04x:%04x]\n", USB_LOCK_VENDOR, USB_LOCK_PRODUCT);
if(libusb_kernel_driver_active(devHandle, DEFAULT_INTERFACE)) {
ret = libusb_detach_kernel_driver(devHandle, DEFAULT_INTERFACE);
if(ret) {
printf("Failed to detach kernel driver: '%s'\n", strerror(-ret));
return NULL;
} else
printf("Detached kernel driver\n");
}
ret = libusb_get_configuration(devHandle, ¤tConfig);
if(ret) {
printf("Failed to get current device configuration: '%s'\n", strerror(-ret));
return NULL;
}
if(currentConfig != DEFAULT_CONFIGURATION)
ret = libusb_set_configuration(devHandle, currentConfig);
if(ret) {
printf("Failed to set device configuration to %d: '%s'\n", DEFAULT_CONFIGURATION, strerror(-ret));
return NULL;
}
ret = libusb_claim_interface(devHandle, DEFAULT_INTERFACE); // interface 0
if(ret) {
printf("Failed to claim interface %d: '%s'\n", DEFAULT_INTERFACE, strerror(-ret));
return NULL;
}
printf( "Claimed device interface [%d]\n", DEFAULT_INTERFACE);
ret = libusb_get_descriptor(devHandle, LIBUSB_DT_DEVICE, 0x00, ch341DescriptorBuffer, 0x12);
if(ret < 0) {
printf("Failed to get device descriptor: '%s'\n", strerror(-ret));
return NULL;
}
printf( "Device reported its revision [%d.%02d]\n",
ch341DescriptorBuffer[12], ch341DescriptorBuffer[13]);
for(i=0;i<0x12;i++)
printf("%02x ", ch341DescriptorBuffer[i]);
printf("\n");
return devHandle;
}
// --------------------------------------------------------------------------
// ch341setstream()
// set the i2c bus speed (speed: 0 = 20kHz; 1 = 100kHz, 2 = 400kHz, 3 = 750kHz)
int32_t ch341setstream( uint32_t speed) {
int32_t ret, i;
uint8_t ch341outBuffer[EEPROM_READ_BULKOUT_BUF_SZ], *outptr;
int32_t actuallen = 0;
outptr = ch341outBuffer;
*outptr++ = mCH341A_CMD_I2C_STREAM;
*outptr++ = mCH341A_CMD_I2C_STM_SET | (speed & 0x3);
*outptr = mCH341A_CMD_I2C_STM_END;
ret = libusb_bulk_transfer(devHandle, BULK_WRITE_ENDPOINT, ch341outBuffer, 3, &actuallen, DEFAULT_TIMEOUT);
if(ret < 0) {
printf("ch341setstream(): Failed write %d bytes '%s'\n", 3, strerror(-ret));
return -1;
}
printf("ch341setstream(): Wrote %d bytes: ", 3);
for(i=0; i < 3; i++)
printf("%02x ", ch341outBuffer[i]);
printf("\n");
return 0;
}
void ch341ReadCmdMarshall(uint8_t *buffer, uint32_t addr, struct EEPROM *eeprom_info)
{
uint8_t *ptr = buffer;
uint8_t msb_addr;
uint32_t size_kb;
*ptr++ = mCH341A_CMD_I2C_STREAM; // 0
*ptr++ = mCH341A_CMD_I2C_STM_STA; // 1
// Write address
*ptr++ = mCH341A_CMD_I2C_STM_OUT | ((*eeprom_info).addr_size + 1); // 2: I2C bus adddress + EEPROM address
if ((*eeprom_info).addr_size >= 2) {
// 24C32 and more
msb_addr = addr >> 16 & (*eeprom_info).i2c_addr_mask;
*ptr++ = (EEPROM_I2C_BUS_ADDRESS | msb_addr) << 1; // 3
*ptr++ = (addr >> 8 & 0xFF); // 4
*ptr++ = (addr >> 0 & 0xFF); // 5
} else {
// 24C16 and less
msb_addr = addr >> 8 & (*eeprom_info).i2c_addr_mask;
*ptr++ = (EEPROM_I2C_BUS_ADDRESS | msb_addr) << 1; // 3
*ptr++ = (addr >> 0 & 0xFF); // 4
}
// Read
*ptr++ = mCH341A_CMD_I2C_STM_STA; // 6/5
*ptr++ = mCH341A_CMD_I2C_STM_OUT | 1; // 7/6
*ptr++ = ((EEPROM_I2C_BUS_ADDRESS | msb_addr) << 1) | 1; // 8/7: Read command
// Configuration?
*ptr++ = 0xE0; // 9/8
*ptr++ = 0x00; // 10/9
if ((*eeprom_info).addr_size < 2)
*ptr++ = 0x10; // x/10
memcpy(ptr, "\x00\x06\x04\x00\x00\x00\x00\x00\x00", 9);
ptr += 9; // 10
size_kb = (*eeprom_info).size/1024;
*ptr++ = size_kb & 0xFF; // 19
*ptr++ = (size_kb >> 8) & 0xFF; // 20
memcpy(ptr, "\x00\x00\x11\x4d\x40\x77\xcd\xab\xba\xdc", 10);
ptr += 10;
// Frame 2
*ptr++ = mCH341A_CMD_I2C_STREAM;
memcpy(ptr, "\xe0\x00\x00\xc4\xf1\x12\x00\x11\x4d\x40\x77\xf0\xf1\x12\x00" \
"\xd9\x8b\x41\x7e\x00\xe0\xfd\x7f\xf0\xf1\x12\x00\x5a\x88\x41\x7e", 31);
ptr += 31;
// Frame 3
*ptr++ = mCH341A_CMD_I2C_STREAM;
memcpy(ptr, "\xe0\x00\x00\x2a\x88\x41\x7e\x06\x04\x00\x00\x11\x4d\x40\x77" \
"\xe8\xf3\x12\x00\x14\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00", 31);
ptr += 31;
// Finalize
*ptr++ = mCH341A_CMD_I2C_STREAM; // 0xAA
*ptr++ = 0xDF; // ???
*ptr++ = mCH341A_CMD_I2C_STM_IN; // 0xC0
*ptr++ = mCH341A_CMD_I2C_STM_STO; // 0x75
*ptr++ = mCH341A_CMD_I2C_STM_END; // 0x00
assert(ptr - buffer == CH341_EEPROM_READ_CMD_SZ);
}
// --------------------------------------------------------------------------
// ch341readEEPROM()
// read n bytes from device (in packets of 32 bytes)
int32_t ch341readEEPROM_param(uint8_t *buffer, uint32_t offset, uint32_t bytestoread, uint32_t ic_size, uint32_t block_size, uint8_t algorithm)
{
uint8_t ch341outBuffer[EEPROM_READ_BULKOUT_BUF_SZ];
uint8_t ch341inBuffer[IN_BUF_SZ]; // 0x100 bytes
int32_t ret = 0, readpktcount = 0;
struct libusb_transfer *xferBulkIn, *xferBulkOut;
struct timeval tv = {0, 100}; // our async polling interval
//
struct EEPROM eeprom_info;
eeprom_info.name = "24c01";
eeprom_info.size = ic_size;
eeprom_info.page_size = (uint16_t)block_size;
eeprom_info.addr_size = 0x0f & algorithm;
eeprom_info.i2c_addr_mask = (0xf0 & algorithm) / 16;
//printf("addr_size=%x addr_mask=%x",eeprom_info.addr_size, eeprom_info.i2c_addr_mask);
//
xferBulkIn = libusb_alloc_transfer(0);
xferBulkOut = libusb_alloc_transfer(0);
if (!xferBulkIn || !xferBulkOut) {
printf("Couldnt allocate USB transfer structures\n");
return -1;
}
byteoffset = 0;
memset(ch341inBuffer, 0, EEPROM_READ_BULKIN_BUF_SZ);
ch341ReadCmdMarshall(ch341outBuffer, offset, &eeprom_info); // Fill output buffer
libusb_fill_bulk_transfer(xferBulkIn, devHandle, BULK_READ_ENDPOINT, ch341inBuffer,
EEPROM_READ_BULKIN_BUF_SZ, cbBulkIn, NULL, DEFAULT_TIMEOUT);
libusb_fill_bulk_transfer(xferBulkOut, devHandle, BULK_WRITE_ENDPOINT,
ch341outBuffer, EEPROM_READ_BULKOUT_BUF_SZ, cbBulkOut, NULL, DEFAULT_TIMEOUT);
libusb_submit_transfer(xferBulkIn);
libusb_submit_transfer(xferBulkOut);
readbuf = buffer;
while (1) {
ret = libusb_handle_events_timeout(NULL, &tv);
if (ret < 0 || getnextpkt == -1) { // indicates an error
printf("ret from libusb_handle_timeout = %d\n", ret);
printf("getnextpkt = %d\n", getnextpkt);
if (ret < 0)
printf("USB read error : %s\n", strerror(-ret));
libusb_free_transfer(xferBulkIn);
libusb_free_transfer(xferBulkOut);
return -1;
}
if (getnextpkt == 1) { // callback function reports a new BULK IN packet received
getnextpkt = 0; // reset the flag
readpktcount++; // increment the read packet counter
byteoffset += EEPROM_READ_BULKIN_BUF_SZ;
if (byteoffset == bytestoread)
break;
libusb_submit_transfer(xferBulkIn); // re-submit request for next BULK IN packet of EEPROM data
if (syncackpkt)
syncackpkt = 0;
// if 4th packet received, we are at end of 0x80 byte data block,
// if it is not the last block, then resubmit request for data
if (readpktcount == 4) {
readpktcount = 0;
ch341ReadCmdMarshall(ch341outBuffer, byteoffset, &eeprom_info); // Fill output buffer
libusb_fill_bulk_transfer(xferBulkOut, devHandle, BULK_WRITE_ENDPOINT, ch341outBuffer,
EEPROM_READ_BULKOUT_BUF_SZ, cbBulkOut, NULL, DEFAULT_TIMEOUT);
libusb_submit_transfer(xferBulkOut); // update transfer struct (with new EEPROM page offset)
// and re-submit next transfer request to BULK OUT endpoint
}
}
}
libusb_free_transfer(xferBulkIn);
libusb_free_transfer(xferBulkOut);
return 0;
}
// Callback function for async bulk in comms
void cbBulkIn(struct libusb_transfer *transfer)
{
int i;
switch (transfer->status) {
case LIBUSB_TRANSFER_COMPLETED:
// display the contents of the BULK IN data buffer
/*
for (i = 0; i < transfer->actual_length; i++) {
if(!(i % 16))
dprintf("%02x ", transfer->buffer[i]);
}
*/
// copy read data to our EEPROM buffer
memcpy(readbuf + byteoffset, transfer->buffer, transfer->actual_length);
getnextpkt = 1;
break;
default:
printf("\ncbBulkIn: error : %d\n", transfer->status);
getnextpkt = -1;
}
return;
}
// Callback function for async bulk out comms
void cbBulkOut(struct libusb_transfer *transfer)
{
syncackpkt = 1;
return;
}
// --------------------------------------------------------------------------
// ch341writeEEPROM()
// write n bytes to 24c32/24c64 device (in packets of 32 bytes)
int32_t ch341writeEEPROM_param(uint8_t *buffer, uint32_t offset, uint32_t bytesum, uint32_t block_size, uint8_t algorithm)
{
printf("ch341writeEEPROM_param\n");
uint8_t addr_size = 0x0f & algorithm;
uint8_t i2c_addr_mask = (0xf0 & algorithm) / 16;
uint8_t ch341outBuffer[512/*EEPROM_WRITE_BUF_SZ*/];
uint8_t *outptr, *bufptr;
uint8_t i2cCmdBuffer[256];
int32_t ret = 0;
uint32_t payload_size, byteoffset = offset;
uint32_t bytes = bytesum;
uint8_t addrbytecount = 0x0f & algorithm + 1; // 24c32 and 24c64 (and other 24c??) use 3 bytes for addressing
int32_t actuallen = 0;
uint32_t page_size = block_size;
uint16_t page_size_left;
uint8_t part_no;
uint8_t *i2cBufPtr;
if (bytesum < page_size) page_size = bytesum;
bufptr = buffer;
while (bytes) {
outptr = i2cCmdBuffer;
if (addr_size >= 2) {
*outptr++ = (uint8_t) (0xa0 | (byteoffset >> 16 & i2c_addr_mask) << 1); // EEPROM device address
*outptr++ = (uint8_t) (byteoffset >> 8 & 0xff); // MSB (big-endian) byte address
} else {
*outptr++ = (uint8_t) (0xa0 | (byteoffset >> 8 & i2c_addr_mask) << 1); // EEPROM device address
}
*outptr++ = (uint8_t) (byteoffset & 0xff); // LSB of 16-bit byte address
memcpy(outptr, bufptr, page_size); // Copy one page
byteoffset += page_size;
bufptr += page_size;
bytes -= page_size;
outptr = ch341outBuffer;
page_size_left = page_size + addrbytecount;
part_no = 0;
i2cBufPtr = i2cCmdBuffer;
while (page_size_left) {
uint8_t to_write = MIN(page_size_left, 28);
*outptr++ = mCH341A_CMD_I2C_STREAM;
if (part_no == 0) { // Start packet
*outptr++ = mCH341A_CMD_I2C_STM_STA;
}
*outptr++ = mCH341A_CMD_I2C_STM_OUT | to_write;
memcpy(outptr, i2cBufPtr, to_write);
outptr += to_write;
i2cBufPtr += to_write;
page_size_left -= to_write;
if (page_size_left == 0) { // Stop packet
*outptr++ = mCH341A_CMD_I2C_STM_STO;
}
*outptr++ = mCH341A_CMD_I2C_STM_END;
part_no++;
}
payload_size = outptr - ch341outBuffer;
/*
for (i = 0; i < payload_size; i++) {
if(!(i % 0x10))
dprintf("\n%04x : ", i);
dprintf("%02x ", ch341outBuffer[i]);
}
*/
ret = libusb_bulk_transfer(devHandle, BULK_WRITE_ENDPOINT,
ch341outBuffer, payload_size, &actuallen, DEFAULT_TIMEOUT);
if (ret < 0) {
printf("Failed to write to EEPROM: '%s'\n", strerror(-ret));
return -1;
}
outptr = ch341outBuffer;
*outptr++ = mCH341A_CMD_I2C_STREAM;
*outptr++ = 0x5a; // what is this 0x5a??
*outptr++ = mCH341A_CMD_I2C_STM_END;
ret = libusb_bulk_transfer(devHandle, BULK_WRITE_ENDPOINT, ch341outBuffer, 3, &actuallen, DEFAULT_TIMEOUT);
if (ret < 0) {
printf("Failed to write to EEPROM: '%s'\n", strerror(-ret));
return -1;
}
}
return 0;
}
// --------------------------------------------------------------------------
int32_t ch341aConnect()
{
//struct libusb_device_handle *devHandle;
if(!(devHandle = ch341configure(USB_LOCK_VENDOR, USB_LOCK_PRODUCT)))
{
return -1;
}
else
{
//if(ch341setstream(CH341_I2C_STANDARD_SPEED) < 0)
if(ch341setstream(CH341_I2C_LOW_SPEED) < 0)
{
printf( "Couldnt set i2c bus speed\n");
return -1;
}
return 0;
}
}
int32_t ch341aShutdown()
{
if (devHandle == NULL) return -1;
libusb_release_interface(devHandle, DEFAULT_INTERFACE);
libusb_close(devHandle);
libusb_exit(NULL);
devHandle = NULL;
return 0;
}
sfp-master-1.0.7/chunks.cpp 0000664 0000000 0000000 00000021702 15060530456 0015605 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2015-2016 Winfried Simon
*
* This software may be used under the terms of the GNU Lesser General
* Public License version 2.1 as published by the Free Software Foundation
* and appearing in the file license.txt included in the packaging of this file.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "chunks.h"
#include
#define NORMAL 0
#define HIGHLIGHTED 1
#define BUFFER_SIZE 0x10000
#define CHUNK_SIZE 0x1000
#define READ_CHUNK_MASK Q_INT64_C(0xfffffffffffff000)
// ***************************************** Constructors and file settings
Chunks::Chunks(QObject *parent): QObject(parent)
{
QBuffer *buf = new QBuffer(this);
setIODevice(*buf);
}
Chunks::Chunks(QIODevice &ioDevice, QObject *parent): QObject(parent)
{
setIODevice(ioDevice);
}
bool Chunks::setIODevice(QIODevice &ioDevice)
{
_ioDevice = &ioDevice;
bool ok = _ioDevice->open(QIODevice::ReadOnly);
if (ok) // Try to open IODevice
{
_size = _ioDevice->size();
_ioDevice->close();
}
else // Fallback is an empty buffer
{
QBuffer *buf = new QBuffer(this);
_ioDevice = buf;
_size = 0;
}
_chunks.clear();
_pos = 0;
return ok;
}
// ***************************************** Getting data out of Chunks
QByteArray Chunks::data(qint64 pos, qint64 maxSize, QByteArray *highlighted)
{
qint64 ioDelta = 0;
int chunkIdx = 0;
Chunk chunk;
QByteArray buffer;
// Do some checks and some arrangements
if (highlighted)
highlighted->clear();
if (pos >= _size)
return buffer;
if (maxSize < 0)
maxSize = _size;
else
if ((pos + maxSize) > _size)
maxSize = _size - pos;
_ioDevice->open(QIODevice::ReadOnly);
while (maxSize > 0)
{
chunk.absPos = LLONG_MAX;
bool chunksLoopOngoing = true;
while ((chunkIdx < _chunks.count()) && chunksLoopOngoing)
{
// In this section, we track changes before our required data and
// we take the editdet data, if availible. ioDelta is a difference
// counter to justify the read pointer to the original data, if
// data in between was deleted or inserted.
chunk = _chunks[chunkIdx];
if (chunk.absPos > pos)
chunksLoopOngoing = false;
else
{
chunkIdx += 1;
qint64 count;
qint64 chunkOfs = pos - chunk.absPos;
if (maxSize > ((qint64)chunk.data.size() - chunkOfs))
{
count = (qint64)chunk.data.size() - chunkOfs;
ioDelta += CHUNK_SIZE - chunk.data.size();
}
else
count = maxSize;
if (count > 0)
{
buffer += chunk.data.mid(chunkOfs, (int)count);
maxSize -= count;
pos += count;
if (highlighted)
*highlighted += chunk.dataChanged.mid(chunkOfs, (int)count);
}
}
}
if ((maxSize > 0) && (pos < chunk.absPos))
{
// In this section, we read data from the original source. This only will
// happen, whe no copied data is available
qint64 byteCount;
QByteArray readBuffer;
if ((chunk.absPos - pos) > maxSize)
byteCount = maxSize;
else
byteCount = chunk.absPos - pos;
maxSize -= byteCount;
_ioDevice->seek(pos + ioDelta);
readBuffer = _ioDevice->read(byteCount);
buffer += readBuffer;
if (highlighted)
*highlighted += QByteArray(readBuffer.size(), NORMAL);
pos += readBuffer.size();
}
}
_ioDevice->close();
return buffer;
}
bool Chunks::write(QIODevice &iODevice, qint64 pos, qint64 count)
{
if (count == -1)
count = _size;
bool ok = iODevice.open(QIODevice::WriteOnly);
if (ok)
{
for (qint64 idx=pos; idx < count; idx += BUFFER_SIZE)
{
QByteArray ba = data(idx, BUFFER_SIZE);
iODevice.write(ba);
}
iODevice.close();
}
return ok;
}
// ***************************************** Set and get highlighting infos
void Chunks::setDataChanged(qint64 pos, bool dataChanged)
{
if ((pos < 0) || (pos >= _size))
return;
int chunkIdx = getChunkIndex(pos);
qint64 posInBa = pos - _chunks[chunkIdx].absPos;
_chunks[chunkIdx].dataChanged[(int)posInBa] = char(dataChanged);
}
bool Chunks::dataChanged(qint64 pos)
{
QByteArray highlighted;
data(pos, 1, &highlighted);
return bool(highlighted.at(0));
}
// ***************************************** Search API
qint64 Chunks::indexOf(const QByteArray &ba, qint64 from)
{
qint64 result = -1;
QByteArray buffer;
for (qint64 pos=from; (pos < _size) && (result < 0); pos += BUFFER_SIZE)
{
buffer = data(pos, BUFFER_SIZE + ba.size() - 1);
int findPos = buffer.indexOf(ba);
if (findPos >= 0)
result = pos + (qint64)findPos;
}
return result;
}
qint64 Chunks::lastIndexOf(const QByteArray &ba, qint64 from)
{
qint64 result = -1;
QByteArray buffer;
for (qint64 pos=from; (pos > 0) && (result < 0); pos -= BUFFER_SIZE)
{
qint64 sPos = pos - BUFFER_SIZE - (qint64)ba.size() + 1;
if (sPos < 0)
sPos = 0;
buffer = data(sPos, pos - sPos);
int findPos = buffer.lastIndexOf(ba);
if (findPos >= 0)
result = sPos + (qint64)findPos;
}
return result;
}
// ***************************************** Char manipulations
bool Chunks::insert(qint64 pos, char b)
{
if ((pos < 0) || (pos > _size))
return false;
int chunkIdx;
if (pos == _size)
chunkIdx = getChunkIndex(pos-1);
else
chunkIdx = getChunkIndex(pos);
qint64 posInBa = pos - _chunks[chunkIdx].absPos;
_chunks[chunkIdx].data.insert(posInBa, b);
_chunks[chunkIdx].dataChanged.insert(posInBa, char(1));
for (int idx=chunkIdx+1; idx < _chunks.size(); idx++)
_chunks[idx].absPos += 1;
_size += 1;
_pos = pos;
return true;
}
bool Chunks::overwrite(qint64 pos, char b)
{
if ((pos < 0) || (pos >= _size))
return false;
int chunkIdx = getChunkIndex(pos);
qint64 posInBa = pos - _chunks[chunkIdx].absPos;
_chunks[chunkIdx].data[(int)posInBa] = b;
_chunks[chunkIdx].dataChanged[(int)posInBa] = char(1);
_pos = pos;
return true;
}
bool Chunks::removeAt(qint64 pos)
{
if ((pos < 0) || (pos >= _size))
return false;
int chunkIdx = getChunkIndex(pos);
qint64 posInBa = pos - _chunks[chunkIdx].absPos;
_chunks[chunkIdx].data.remove(posInBa, 1);
_chunks[chunkIdx].dataChanged.remove(posInBa, 1);
for (int idx=chunkIdx+1; idx < _chunks.size(); idx++)
_chunks[idx].absPos -= 1;
_size -= 1;
_pos = pos;
return true;
}
// ***************************************** Utility functions
char Chunks::operator[](qint64 pos)
{
return data(pos, 1).at(0);
}
qint64 Chunks::pos()
{
return _pos;
}
qint64 Chunks::size()
{
return _size;
}
int Chunks::getChunkIndex(qint64 absPos)
{
// This routine checks, if there is already a copied chunk available. If os, it
// returns a reference to it. If there is no copied chunk available, original
// data will be copied into a new chunk.
int foundIdx = -1;
int insertIdx = 0;
qint64 ioDelta = 0;
for (int idx=0; idx < _chunks.size(); idx++)
{
Chunk chunk = _chunks[idx];
if ((absPos >= chunk.absPos) && (absPos < (chunk.absPos + chunk.data.size())))
{
foundIdx = idx;
break;
}
if (absPos < chunk.absPos)
{
insertIdx = idx;
break;
}
ioDelta += chunk.data.size() - CHUNK_SIZE;
insertIdx = idx + 1;
}
if (foundIdx == -1)
{
Chunk newChunk;
qint64 readAbsPos = absPos - ioDelta;
qint64 readPos = (readAbsPos & READ_CHUNK_MASK);
_ioDevice->open(QIODevice::ReadOnly);
_ioDevice->seek(readPos);
newChunk.data = _ioDevice->read(CHUNK_SIZE);
_ioDevice->close();
newChunk.absPos = absPos - (readAbsPos - readPos);
newChunk.dataChanged = QByteArray(newChunk.data.size(), char(0));
_chunks.insert(insertIdx, newChunk);
foundIdx = insertIdx;
}
return foundIdx;
}
#ifdef MODUL_TEST
int Chunks::chunkSize()
{
return _chunks.size();
}
#endif
sfp-master-1.0.7/chunks.h 0000664 0000000 0000000 00000003745 15060530456 0015261 0 ustar 00root root 0000000 0000000 #ifndef CHUNKS_H
#define CHUNKS_H
/** \cond docNever */
/*! The Chunks class is the storage backend for QHexEdit.
*
* When QHexEdit loads data, Chunks access them using a QIODevice interface. When the app uses
* a QByteArray interface, QBuffer is used to provide again a QIODevice like interface. No data
* will be changed, therefore Chunks opens the QIODevice in QIODevice::ReadOnly mode. After every
* access Chunks closes the QIODevice, that's why external applications can overwrite files while
* QHexEdit shows them.
*
* When the the user starts to edit the data, Chunks creates a local copy of a chunk of data (4
* kilobytes) and notes all changes there. Parallel to that chunk, there is a second chunk,
* which keep track of which bytes are changed and which not.
*
*/
#include
struct Chunk
{
QByteArray data;
QByteArray dataChanged;
qint64 absPos;
};
class Chunks: public QObject
{
Q_OBJECT
public:
// Constructors and file settings
Chunks(QObject *parent);
Chunks(QIODevice &ioDevice, QObject *parent);
bool setIODevice(QIODevice &ioDevice);
// Getting data out of Chunks
QByteArray data(qint64 pos=0, qint64 count=-1, QByteArray *highlighted=0);
bool write(QIODevice &iODevice, qint64 pos=0, qint64 count=-1);
// Set and get highlighting infos
void setDataChanged(qint64 pos, bool dataChanged);
bool dataChanged(qint64 pos);
// Search API
qint64 indexOf(const QByteArray &ba, qint64 from);
qint64 lastIndexOf(const QByteArray &ba, qint64 from);
// Char manipulations
bool insert(qint64 pos, char b);
bool overwrite(qint64 pos, char b);
bool removeAt(qint64 pos);
// Utility functions
char operator[](qint64 pos);
qint64 pos();
qint64 size();
private:
int getChunkIndex(qint64 absPos);
QIODevice * _ioDevice;
qint64 _pos;
qint64 _size;
QList _chunks;
#ifdef MODUL_TEST
public:
int chunkSize();
#endif
};
/** \endcond docNever */
#endif // CHUNKS_H
sfp-master-1.0.7/cmake/ 0000775 0000000 0000000 00000000000 15060530456 0014664 5 ustar 00root root 0000000 0000000 sfp-master-1.0.7/cmake/FindLibUSB.cmake 0000664 0000000 0000000 00000003467 15060530456 0017561 0 ustar 00root root 0000000 0000000 # - Find libusb for portable USB support
#
# If the LibUSB_ROOT environment variable
# is defined, it will be used as base path.
# The following standard variables get defined:
# LibUSB_FOUND: true if LibUSB was found
# LibUSB_INCLUDE_DIR: the directory that contains the include file
# LibUSB_LIBRARIES: the libraries
find_package(PkgConfig)
IF(PKG_CONFIG_FOUND)
IF(DEPENDS_DIR) #Otherwise use System pkg-config path
SET(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPENDS_DIR}/libusb/lib/pkgconfig")
ENDIF()
SET(MODULE "libusb-1.0")
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(MODULE "libusb-1.0>=1.0.20")
ENDIF()
IF(LibUSB_FIND_REQUIRED)
SET(LibUSB_REQUIRED "REQUIRED")
ENDIF()
PKG_CHECK_MODULES(LibUSB ${LibUSB_REQUIRED} ${MODULE})
FIND_LIBRARY(LibUSB_LIBRARY
NAMES ${LibUSB_LIBRARIES}
HINTS ${LibUSB_LIBRARY_DIRS}
)
SET(LibUSB_LIBRARIES ${LibUSB_LIBRARY})
RETURN()
ENDIF()
FIND_PATH(LibUSB_INCLUDE_DIRS
NAMES libusb.h
PATHS
"${DEPENDS_DIR}/libusb"
"${DEPENDS_DIR}/libusbx"
ENV LibUSB_ROOT
PATH_SUFFIXES
include
libusb
include/libusb-1.0
)
SET(LIBUSB_NAME libusb)
FIND_LIBRARY(LibUSB_LIBRARIES
NAMES ${LIBUSB_NAME}-1.0
PATHS
"${DEPENDS_DIR}/libusb"
"${DEPENDS_DIR}/libusbx"
ENV LibUSB_ROOT
PATH_SUFFIXES
x64/Release/dll
x64/Debug/dll
Win32/Release/dll
Win32/Debug/dll
MS64
MS64/dll
)
IF(WIN32)
FIND_FILE(LibUSB_DLL
${LIBUSB_NAME}-1.0.dll
PATHS
"${DEPENDS_DIR}/libusb"
"${DEPENDS_DIR}/libusbx"
ENV LibUSB_ROOT
PATH_SUFFIXES
x64/Release/dll
x64/Debug/dll
Win32/Release/dll
Win32/Debug/dll
MS64
MS64/dll
)
ENDIF()
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUSB FOUND_VAR LibUSB_FOUND
REQUIRED_VARS LibUSB_LIBRARIES LibUSB_INCLUDE_DIRS)
sfp-master-1.0.7/commands.cpp 0000664 0000000 0000000 00000011410 15060530456 0016106 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2015-2016 Winfried Simon
*
* This software may be used under the terms of the GNU Lesser General
* Public License version 2.1 as published by the Free Software Foundation
* and appearing in the file license.txt included in the packaging of this file.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "commands.h"
#include
// Helper class to store single byte commands
class CharCommand : public QUndoCommand
{
public:
enum CCmd {insert, removeAt, overwrite};
CharCommand(Chunks * chunks, CCmd cmd, qint64 charPos, char newChar,
QUndoCommand *parent=0);
void undo();
void redo();
bool mergeWith(const QUndoCommand *command);
int id() const { return 1234; }
private:
Chunks * _chunks;
qint64 _charPos;
bool _wasChanged;
char _newChar;
char _oldChar;
CCmd _cmd;
};
CharCommand::CharCommand(Chunks * chunks, CCmd cmd, qint64 charPos, char newChar, QUndoCommand *parent)
: QUndoCommand(parent)
, _chunks(chunks)
, _charPos(charPos)
, _wasChanged(false)
, _newChar(newChar)
, _oldChar('\0')
, _cmd(cmd)
{
}
bool CharCommand::mergeWith(const QUndoCommand *command)
{
const CharCommand *nextCommand = static_cast(command);
bool result = false;
if (_cmd != CharCommand::removeAt)
{
if (nextCommand->_cmd == overwrite)
if (nextCommand->_charPos == _charPos)
{
_newChar = nextCommand->_newChar;
result = true;
}
}
return result;
}
void CharCommand::undo()
{
switch (_cmd)
{
case insert:
_chunks->removeAt(_charPos);
break;
case overwrite:
_chunks->overwrite(_charPos, _oldChar);
_chunks->setDataChanged(_charPos, _wasChanged);
break;
case removeAt:
_chunks->insert(_charPos, _oldChar);
_chunks->setDataChanged(_charPos, _wasChanged);
break;
}
}
void CharCommand::redo()
{
switch (_cmd)
{
case insert:
_chunks->insert(_charPos, _newChar);
break;
case overwrite:
_oldChar = (*_chunks)[_charPos];
_wasChanged = _chunks->dataChanged(_charPos);
_chunks->overwrite(_charPos, _newChar);
break;
case removeAt:
_oldChar = (*_chunks)[_charPos];
_wasChanged = _chunks->dataChanged(_charPos);
_chunks->removeAt(_charPos);
break;
}
}
UndoStack::UndoStack(Chunks * chunks, QObject * parent)
: QUndoStack(parent)
{
_chunks = chunks;
_parent = parent;
this->setUndoLimit(1000);
}
void UndoStack::insert(qint64 pos, char c)
{
if ((pos >= 0) && (pos <= _chunks->size()))
{
QUndoCommand *cc = new CharCommand(_chunks, CharCommand::insert, pos, c);
this->push(cc);
}
}
void UndoStack::insert(qint64 pos, const QByteArray &ba)
{
if ((pos >= 0) && (pos <= _chunks->size()))
{
QString txt = QString(tr("Inserting %1 bytes")).arg(ba.size());
beginMacro(txt);
for (int idx=0; idx < ba.size(); idx++)
{
QUndoCommand *cc = new CharCommand(_chunks, CharCommand::insert, pos + idx, ba.at(idx));
this->push(cc);
}
endMacro();
}
}
void UndoStack::removeAt(qint64 pos, qint64 len)
{
if ((pos >= 0) && (pos < _chunks->size()))
{
if (len==1)
{
QUndoCommand *cc = new CharCommand(_chunks, CharCommand::removeAt, pos, char(0));
this->push(cc);
}
else
{
QString txt = QString(tr("Delete %1 chars")).arg(len);
beginMacro(txt);
for (qint64 cnt=0; cnt= 0) && (pos < _chunks->size()))
{
QUndoCommand *cc = new CharCommand(_chunks, CharCommand::overwrite, pos, c);
this->push(cc);
}
}
void UndoStack::overwrite(qint64 pos, int len, const QByteArray &ba)
{
if ((pos >= 0) && (pos < _chunks->size()))
{
QString txt = QString(tr("Overwrite %1 chars")).arg(len);
beginMacro(txt);
removeAt(pos, len);
insert(pos, ba);
endMacro();
}
}
sfp-master-1.0.7/commands.h 0000664 0000000 0000000 00000002632 15060530456 0015561 0 ustar 00root root 0000000 0000000 #ifndef COMMANDS_H
#define COMMANDS_H
/** \cond docNever */
#include
#include "chunks.h"
/*! CharCommand is a class to provid undo/redo functionality in QHexEdit.
A QUndoCommand represents a single editing action on a document. CharCommand
is responsable for manipulations on single chars. It can insert. overwrite and
remove characters. A manipulation stores allways two actions
1. redo (or do) action
2. undo action.
CharCommand also supports command compression via mergeWith(). This enables
the user to perform an undo command e.g. 3 steps in a single command.
If you for example insert a new byt "34" this means for the editor doing 3
steps: insert a "00", overwrite it with "03" and the overwrite it with "34". These
3 steps are combined into a single step, insert a "34".
The byte array oriented commands are just put into a set of single byte commands,
which are pooled together with the macroBegin() and macroEnd() functionality of
Qt's QUndoStack.
*/
class UndoStack : public QUndoStack
{
Q_OBJECT
public:
UndoStack(Chunks *chunks, QObject * parent=0);
void insert(qint64 pos, char c);
void insert(qint64 pos, const QByteArray &ba);
void removeAt(qint64 pos, qint64 len=1);
void overwrite(qint64 pos, char c);
void overwrite(qint64 pos, int len, const QByteArray &ba);
private:
Chunks * _chunks;
QObject * _parent;
};
/** \endcond docNever */
#endif // COMMANDS_H
sfp-master-1.0.7/dialogabout.cpp 0000664 0000000 0000000 00000002065 15060530456 0016605 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2024 - 2025 Mikhail Medvedev
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "dialogabout.h"
#include "ui_dialogabout.h"
DialogAbout::DialogAbout(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogAbout)
{
ui->setupUi(this);
ui->label_7->setTextFormat(Qt::RichText);
ui->label_7->setTextInteractionFlags(Qt::TextBrowserInteraction);
ui->label_7->setOpenExternalLinks(true);
ui->label_8->setText("V1.0.7");
}
DialogAbout::~DialogAbout()
{
delete ui;
}
void DialogAbout::on_pushButton_clicked()
{
DialogAbout::close();
}
sfp-master-1.0.7/dialogabout.h 0000664 0000000 0000000 00000001635 15060530456 0016254 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2024 Mikhail Medvedev
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef DIALOGABOUT_H
#define DIALOGABOUT_H
#include
namespace Ui {
class DialogAbout;
}
class DialogAbout : public QDialog
{
Q_OBJECT
public:
explicit DialogAbout(QWidget *parent = nullptr);
~DialogAbout();
private slots:
void on_pushButton_clicked();
private:
Ui::DialogAbout *ui;
};
#endif // DIALOGABOUT_H
sfp-master-1.0.7/dialogabout.ui 0000664 0000000 0000000 00000013144 15060530456 0016440 0 ustar 00root root 0000000 0000000
DialogAbout
0
0
496
603
496
0
571
16777215
About SFP-Master
:/res/img/write64.png:/res/img/write64.png
-
-
SFP-Master is a free software programmer of optical SFP modules for CH341a devices. It can be used to read, write and save SFP module data to the computer. It requires an SFP to I2C adapter. This adapter is used to read and program SFP-module data. It must be inserted into the slot labelled 24xxx of the CH341a programmer.
true
-
-
:/res/img/ch341_black150.png
-
:/res/img/adapter.png
-
<html><head/><body><p>In this program <a href="https://github.com/Simsys/qhexedit2/"><span style=" text-decoration: underline; color:#0000ff;">QhexEditor2</span></a> widget and modified programmer <a href="https://github.com/setarcos/ch341prog"><span style=" text-decoration: underline; color:#0000ff;">setarcos</span></a> were used.</p><p>The page on GitHub is <a href="https://github.com/bigbigmdm/SFP-Master/tree/main"><span style=" text-decoration: underline; color:#0000ff;">here</span></a>, the OSHWLAB page is <a href="https://oshwlab.com/einkreader/ch341a_sfp_adapter"><span style=" text-decoration: underline; color:#0000ff;">here</span></a>. </p></body></html>
true
-
Qt::Vertical
20
112
-
-
-
Written by 2024 Mikhail Medvedev
-
-
90
0
90
16777215
Version:
-
1.0.1
-
Qt::Horizontal
40
20
-
90
25
Close
sfp-master-1.0.7/dialogpass.cpp 0000664 0000000 0000000 00000011500 15060530456 0016433 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2024 Mikhail Medvedev
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "dialogpass.h"
#include "ui_dialogpass.h"
#include "mainwindow.h"
#include
//#include
#include
DialogPass::DialogPass(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogPass)
{
ui->setupUi(this);
QRegularExpression reHex3( "[0-2][A-Fa-f0-9]{2,2}" );
QRegularExpression reHex2( "[A-Fa-f0-9]{1,2}" );
QRegularExpressionValidator *validatorA = new QRegularExpressionValidator(reHex3, this);
QRegularExpressionValidator *validatorL = new QRegularExpressionValidator(reHex2, this);
ui->lineEdit->setValidator(validatorA);
ui->lineEdit_2->setValidator(validatorL);
ui->lineEdit_3->setValidator(validatorL);
ui->lineEdit_4->setValidator(validatorL);
ui->lineEdit_5->setValidator(validatorL);
}
void DialogPass::setID(const uint id, uint32_t userAddr, uint32_t userPass)
{
uint8_t firstDigit = 0;
switch (id)
{
case 0:
ui->radioButton_0->setChecked(true);
break;
case 1:
ui->radioButton_1->setChecked(true);
break;
case 2:
ui->radioButton_2->setChecked(true);
break;
case 3:
ui->radioButton_3->setChecked(true);
break;
case 4:
ui->radioButton_4->setChecked(true);
break;
default:
ui->radioButton_0->setChecked(true);
break;
}
firstDigit = static_cast(userAddr >> 8) + 0x30;
if (firstDigit > 0x32) firstDigit = 0x30;
ui->lineEdit->setText(QString(static_cast(firstDigit)) + bytePrt(static_cast(userAddr & 0xff)));
ui->lineEdit_2->setText(bytePrt(static_cast((userPass >> 24) & 0xff)));
ui->lineEdit_3->setText(bytePrt(static_cast((userPass >> 16) & 0xff)));
ui->lineEdit_4->setText(bytePrt(static_cast((userPass >> 8) & 0xff)));
ui->lineEdit_5->setText(bytePrt(static_cast(userPass & 0xff)));
}
DialogPass::~DialogPass()
{
delete ui;
}
void DialogPass::on_pushButton_clicked()
{
uint8_t id = 0;
if (ui->radioButton_0->isChecked()) id = 0;
if (ui->radioButton_1->isChecked()) id = 1;
if (ui->radioButton_2->isChecked()) id = 2;
if (ui->radioButton_3->isChecked()) id = 3;
if (ui->radioButton_4->isChecked())
{
id = 4;
setUserPassword();
}
//return id
emit sendID(id);
DialogPass::close();
}
void DialogPass::setUserPassword()
{
uint32_t userAddr = 0, userPass = 0;
QString buf = "";
if ((ui->lineEdit->text().isEmpty()) || (ui->lineEdit_2->text().isEmpty()) || (ui->lineEdit_3->text().isEmpty()) || (ui->lineEdit_4->text().isEmpty()) || (ui->lineEdit_5->text().isEmpty()))
{
QMessageBox::about(this, tr("Error"), tr("Invalid field value."));
return;
}
if (ui->lineEdit_2->text().length() == 1) ui->lineEdit_2->setText("0" + ui->lineEdit_2->text());
if (ui->lineEdit_3->text().length() == 1) ui->lineEdit_3->setText("0" + ui->lineEdit_3->text());
if (ui->lineEdit_4->text().length() == 1) ui->lineEdit_4->setText("0" + ui->lineEdit_4->text());
if (ui->lineEdit_5->text().length() == 1) ui->lineEdit_5->setText("0" + ui->lineEdit_5->text());
userAddr = hexToInt(ui->lineEdit->text());
buf = ui->lineEdit_2->text() + ui->lineEdit_3->text() + ui->lineEdit_4->text() + ui->lineEdit_5->text();
userPass = hexToInt(buf);
emit sendUserPass(userAddr, userPass);
}
uint32_t DialogPass::hexToInt(QString str)
{
unsigned char c;
uint32_t len = static_cast(str.length());
QByteArray bstr = str.toLocal8Bit();
if ((len > 0) && (len < 9))
{
uint32_t i, j = 1;
uint32_t addr = 0;
for (i = len; i >0; i--)
{
c = static_cast(bstr[i-1]);
if ((c >= 0x30) && (c <=0x39)) addr = addr + (c - 0x30) * j;
if ((c >= 0x41) && (c <= 0x46)) addr = addr + (c - 0x37) * j;
if ((c >= 0x61) && (c <= 0x66)) addr = addr + (c - 0x57) * j;
j = j * 16;
}
return addr;
}
else return 0;
}
QString DialogPass::bytePrt(unsigned char z)
{
unsigned char s;
s = z / 16;
if (s > 0x9) s = s + 0x37;
else s = s + 0x30;
z = z % 16;
if (z > 0x9) z = z + 0x37;
else z = z + 0x30;
return QString(static_cast(s)) + QString(static_cast(z));
}
sfp-master-1.0.7/dialogpass.h 0000664 0000000 0000000 00000002242 15060530456 0016103 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2024 Mikhail Medvedev
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef DIALOGPASS_H
#define DIALOGPASS_H
#include
namespace Ui {
class DialogPass;
}
class DialogPass : public QDialog
{
Q_OBJECT
public:
explicit DialogPass(QWidget *parent = nullptr);
~DialogPass();
void setID(const uint id, uint32_t userAddr, uint32_t userPass);
void setUserPassword();
uint32_t hexToInt(QString str);
QString bytePrt(unsigned char z);
private slots:
void on_pushButton_clicked();
signals:
void sendID(uint8_t);
void sendUserPass(uint32_t userAddr, uint32_t userPass);
private:
Ui::DialogPass *ui;
};
#endif // DIALOGPASS_H
sfp-master-1.0.7/dialogpass.ui 0000664 0000000 0000000 00000007550 15060530456 0016300 0 ustar 00root root 0000000 0000000
DialogPass
0
0
308
250
308
0
Password settings
:/res/img/write64.png:/res/img/write64.png
-
-
None
-
Default-1
-
Default-2
-
Default-3
-
User defined:
-
-
Start address (HEX):
-
17B
-
Password (HEX):
-
-
Qt::AlignCenter
-
Qt::AlignCenter
-
Qt::AlignCenter
-
Qt::AlignCenter
-
-
Qt::Horizontal
40
20
-
Ok
sfp-master-1.0.7/gerber/ 0000775 0000000 0000000 00000000000 15060530456 0015052 5 ustar 00root root 0000000 0000000 sfp-master-1.0.7/gerber/Gerber_CH341A_SFP_ADAPTER_PCB_CH341A_SFP_ADAPTER_2024-11-22.zip 0000664 0000000 0000000 00000052405 15060530456 0026133 0 ustar 00root root 0000000 0000000 PK
àdvY_w{©õ ( Drill_NPTH_Through.DRL=ޱnƒ0E÷÷^ºôžme@ !‘ A‘‡¦KdÀ4‘š ™6Rúõ¥z¥;œ3\ÝZ&Pæ¸[Õ[€ˆá\È6»ª8oÇ:7K‘
ÈÌ©)–ûÃþÜT¹)ÖUöé|ÊöÙžÍÅ_ïÈ
;=‹uÎ*ŒBŒ#—¢çŒxJ2"ÈD4`Ò:ˤ•=
ûŽkDúdpmÄnVV«ˆd«(*áƒíD7hÙY
h¾X:ß:ÏJwwÞ~Žž=œŸ®ãaÈ!ÛŽnº~;FlÉ(Tˆìvƒ´úx#(5þ:xE®çœ(ž·ÿ‘“˜±?PK
àdvY±jJ¡· Ë Drill_PTH_Through.DRL]‘MkÛ@†ïû+téÍó±Ÿ>Eq65A‡º— Û«&ÐÄ ·ô×wµ’ãUB<³ÏÌïn¤›ª~|(gëŸ3 ÈÃ'Š»‡uõt÷ýq³¬E4˜ô—}NþÄáÞË*2”ä°*ÐêŠ2¢O‹¨”K7“Sä)Ò9!Œš¢ž†Ô—Ðán2!ç+*’)ö¿+0EA˜¤wÄKއÞð´×hÃý«"YJq<
¡Pr:b´vC5AÅÚˆ
ƒøPK
àdvYCumÎì Drill_PTH_Through_Via.DRL޽nƒ0 ÷ï)¼t#èóÆ1 „H ¢ÈŠš.È€iš ™6Rúô¥n¸›®
êœŽÛ z1\t¬Švÿzªs“ñ„Cj.M‘5UnФ•}:ŸÆZsõó÷ǵ=OÒÂ.Ïb—“‡£PÄaÈĆÒ
c„²„Š$Š åшªs2ªr‡žiD-5ºnb7r+F«eDE'©âR±Ñö¼µè-
èzX:ß9OJwwÞ~Íž<œ_¦ùN0dæO·L?ŽP’…S$·¤Û(1‚Rã_ƒ7䊱ø‚TĨ¡æ¿PK
àdvYqã]_x Ÿ Gerber_TopLayer.GTL…VKâ8¾÷¯Èa¸´2È.WùÁÕÌö¥ÙYõì¡9#$ZÀŽ4ûë·ìÄNœm?dø>»Þåò‹Àâµú]_ÅßçÏðéñá…ÁoÕõ÷·åSñKÏiަ,@ ~•ò+@!a!qAÔìT´vSkƒvƒ;¡œÛmÁ áôÎîëÍ®4õ^U¸¯œ&‰-ÒöÕVm÷·•,¥h$½Ô—M}áåT_ªÛùRüª/×ÃùTˆ94;~l«c½(¤Åg}ÙÖ§[Y¼oÕÞ-Š?Ïü¥Þëmûµh-õÉ˹‡Sñq8¸±è–?ÖÕîpúYü[_Î×âüq¸ñù¢,ªÍõ|üçVŸçëáΗÈ"nõO¶²:í
*võöðQYÒì¯OïHk¤ÇÙÃlõ}µâõaö´Z==¿}—ÀŽ–_øJÁ¿_”ßö´\Jñ\й²…o¥œ“â]Ì‘—ˆÃ[ sáñf‰¸z.s ŸY€¦ `tc£æÝÿ;‘ 0~¿éÖÛ¨! ³×¿–¼.}ÞÞ,"‰µ4$…ÑKR%=£¬Ñ¢Ç´ ¶Ê®% ³Ìw‚#vxJI)ÚíQ%)$MmL¦R‰Øª”,;¸¡Ø«¾ÊÄHr (é<¨4@AJZͳÅ$¨TÉ[ܽäuŽ§ÜˆÌýpÆPÄøôe4^g‘›Š¾6J†+m²H´ð¥@°ýàAR'ŸòyËA_¹Þ=@£i‚¢.d É‚pRÝ“ÓÛcØ'A„Sý°+Ž&iꘔMx´Ñq- Erœ‘Öƒ$|´ñâ”›!È»Âi‰¬)Ǹzt·Ïú
äŒÛUb[ž96xßd¬_̆ïã0‡Áx.§¤Ð:b\Z64“êLO ÖÊt òEéc$œuƒòîƒÑPž7zS%‰˜!ß‚l ¢d
õ@Pô
Cú`
Ÿ7cÐ÷¾v=LÌ{£E#"‘ûÿ6'Cšt…¤NÜJ-Ò1”JéPHaÍ{Ü—(iÛ=:·öeëeEÏ7Œ·#2(¤”-È#Ý8µvÊR¼”9%,z³8ÉY3E†?kÒvþÆT˜”ݗѶjbäñ˜b¢E(n©¸ø¼ûjÄ ?HSµîN0m¹Œ™XÉc†KѹIƶ¦ç-˜fÚk?1
½b×bÄH7´ 1vhubÌ==<)¶%Fßµ€†YHŒ¿~Ý$£†±î˜»ùN¿‰î5_`Óáá9}66éôÙŒÉtCäg‡³5°Y%™³äEòµ¨zŒöŒ5>y<Äu!ß\ÖvÍÕIm'2†…Ýì”Ú
3 “•£¦œVȧiB-Ï
fô=¹äâ=¹á“ÐÜcÒôå¶LzÅŒÿÔsv–xyu7¸ÕÔЯ1ц«GLättŒBâܘˆÍäén‚7#!͉@›í_÷Y÷%&>FLš%ÃÉ4Ð鱯áÓdÄäíÝÇÓ+?þPK
àdvY
d(ng) Q— Gerber_BottomLayer.GBLu}K¯&ÅríüüŠ=0ÔFù~0ôÍäp}uþòåß¾ƒü_?üõ¿ÿúþ›—ÿ)_å¯R}÷\Hÿìý?‡ðâÃ×>}óõ˘qíÇ¥¦öcúÙÅÞþ)tçzù¹ýòñÇŸßÕ¿Äé—½dŸ~,¾ÅÒÂ/~Š?ýÒÓOü;ï®'}÷ñÏ?þ‰?þøøç‡ÏŸþ|ùŸþõë§?^ÜWáúÅüôá·_¿xç^þëãŸ?}üãó»—|úüáóÇŸ¿~ù?Ÿð—¿üöñ§ù×—ë¦÷¿þþñ>篗_ÿxùý×ß~ƒà3=¯ÿöñÃÏ¿þñŸ/ÿï㟟þzùôû¯ŸqÿË»—?þõé·ÿþüñå¿>ýõëçqÿ»„G|þøŸ@ùáŸ_òËÏúõ÷¿áI_üÛüý›R~MùË/þöÅ÷ÿþý÷øóo_|óý÷ß|û÷_4ôÝ?áßðÎáÿù³oÞ¿÷îÛwî«Ø …)ðÿx翊µºüW>†,òp=éº8¯ýà¾røG~ÿñ.ÁÁÈÓ·ï¬ ‹Ç”¼…‚’
ª¾ïª?tû¦Æß×MÐÙŒTF»œÏaèáïÿ÷=þü.–/ÿöCNÉ•öšK÷>¼w£sýãç…òVÓûKKwù5×à]Q*ÕA„kND±;<°öPƒy_|N*K-ÊpsYM%QÖC‰S–|¨”UzYÎ=YqòÚ›.”9äw@_=Ÿ²«S£ïÄ’{ròÞRcä; %ˆ¬Â5†¬ÔR.Y!û|ÊZ+ÙÞ[[ŠÎÛwÔÖChKí1Œv(Á‹¬ÄîGÛR—{{£µô˜DÖ]ŒµÚ!‹-àÝöÞØZ*Ù¾#vô‹·Xbo-˜“ø¶mÉåÞ½ÕArµi;¦® €Üä^ÜTÂ!‹ýJYÏIôCí2ÐY"s°ÊŠËNeÙ¡RpÉ7½†BYJQß‘ñ@ÊåÞ”J€½¤½Þ›aB|nÖþ¶‘rQô‡ÞoÔ¢hª—œÙŽÚ|Õ~sÍ¡?R@y^ǃð¼ìhøÚGôA¸§ÏÞ©=Y„ƒ¹ãwÙ7Õ‹<B²ïÍÍÇ|àË=‡àm;Šƒ+íEôð%Y½”èzŒV…Æ!Ï‹¸ÏK
§ÌWÈhä^1—³šï(4;ôQ)øwêP^(j/ÐZ÷îø]
½æãyðŠTì{z±6‹¯ ÌÕhÛÇ”˜m{3m¼X½ ¼ '¬þ_JJVÏP|ìÅöDÈ*ÕâƒÄ0˜u€›õ©åÈ>g\SÚÁç!k›¾Yñ+žº\y¯onÅÝÆ{³ê@â3U[š‘…êªë^F{Äï’´ãJ
¡ßÈ•5><Y
KJª®qæ½½B ö5ìÆè›Åa€õ[à"Ü“’ܽç.yÍžâÏž ¸dMÊ›¶L:e1Y24blîÈ£!¾ÙD:dˆ‚Õ!RÔ%®@–5x@†D‹ß¤‘¬²ÔJ‡,;¿î…â+s+KFâYÒÀÀn¯^+ÚÂçáŸéµ"Ò§%¼·9ߊÈÔ^‘`º?d !+0×)C¿"q½6øÜ&ˆ²¯
Hš´# "³4(RÛuü&‹®ÌQ¡Eº˜Ê@,ðŽˆLª¿K#{!=FI|åÛh©.Ìh\ˆõµ‘iH_2+d%D•‘° @.|Ìn”…‹ï±€£âÝ0•9˜d[¢_Óxâ»$Ȩ;e)èï@‹ù ‹(˜O@(óAß³óÂ;ð6•yF`)â3¤Ð>ÛÑê’F€V\ƒ¦ÕˆìÚ2zÔ«æç¨+/É+¸Ú+˜ôÜ£Þ‹t“d9h9„]DA´/é{]^ÐŽ˜R×ߥŠtŽ>O!ê;ð L™ï%(QÀâ]\ï€ñ‚uÀéÚÂü*lý+~é³û¯#kò¯µ¸¢våÜÈ•dq¾HKÛ©`1â3eFø
Ö&¤2€€¯Â)ÄÖ £ƒ¿"i¿AæÀ¦"øŽÈZ¯{eP×½Oz…¹T_l9¼75› CÀ.&†A†°M¬£ö|Œ&&–aõ!6'!‹ -ö€
÷³Xä@;-fùw;Ÿ×JRÆÁ¨_¯„¯øÐ_þõ""ë Ùòõ"S–œC$½ˆ†ÊÀõÒëEHTFšõz•‘¿^çøÝ BöyaZïŸEŸ#W)æÎàÉxßʆöÆxßâzìqUmˆUò,‰Ý#{#dÁWáåÚ^„Ö–ñ»Þ|×{XÃ:"ruKÖáƒÝƒ¹T+[®šHUA|ƒ±‹¶LžŠôÓÖ«á.HqV8“
a@m›*!+Ô|¢K‡Z—ô^áÛQB”%lôc–j U+òu °) d|‡OÎz;xVä3J±°„ðmkŠé"õ$Õ’Ü[7áõ"–BrÒ…²GNÓRE› Û-
éÙ*ªƒ°/cC"U·Â„žŽÛQn!q/J,0ý j` °à=µÍ„Ñ4B dŒ·ª¡Q²ÜnºC^d:N ™.ðÆ¤™ÆlD!ÆÀDuÆÁË:+¬(OãaÞ ‰#¥Ãpóªu’Öa`»sMa'9ìönÔ4 ‚ö5ÈZ¢"b#$f½•}È(a›xª¹@Æö€í!ôËóPº£Æy½JP‘ùÐÅF©:e¨a_¯’Vd`8ŒX£ô‚wÇïäa©öyH+`潈™(¨^¯ÒWdŒøFé;eLŒŠ£ôÇKð¼QúŠìŠ8W髲Èìx
1¨å"ôŠY)‰÷Ž!•üíõÚŠDêe¨Ü
,d•¨|u0÷¬²1ô¢²Øª½†hTFâðz
åˆ,¸‡×kÈGe¨›Úë54$²H~ñz
!©ap¨IdÈ¡>›¾ìxJK‡ˆdÆÜ F“z3/@œÉlÆݜIÌ6¸È†iÔ«U™²™Æw–ùÕèhŠvÑ™:“ádP,ù6:Ò8ŒÞk$úÜ|ë—cÌõ[sŠ _
!:æ*J“»rÓy³ÐbèÑY°u'Ô\:µ_®Ž¹:¿e<£Y#AzOË.c‚âj;e½ÖXq^³FÜ·’TŒHtXœ‚,£/‡Îc(Åt2t§K6œ±¡ŠRš6¶¡;5pMçnÕuÕé¹UƒÊ,¡ ‚20)¾|ÚNñfB¥á3˜¡/£ÒëôÌïfp4Ï›AÔ¼ÕnÞâc•ŠmGäÈX²í4×èeÒ\£¿Is¡ûrÒÜŽÞ;inG%yÒÜó;i.Ü$œ4ñ<ž4·ï}¾ü¸·| Å@^ó¶%¬ïj8šì]B¡›¬n¼Û
}*Ñ#¿TM SÛž`óʱu!Å8
Ø‘}ƒŽL¡Q¾v
á[¯rд˜O¡IÞÒ¿1c¼¨Ü˜qä0ÝÉŒ#
3F_õ3FoÌi¦Þ˜1t[n̘•ãG>ìdÆ‘ÉõdÆhrº1cz'·"(/2”Q r)à
•fÂ*
1ÔVTgHpÓ§¦qcÆÁ…rcÆ1ôÆŒÇÐÉŒ=ÛÉŒ©ž3FMÑoÌX„FÉr»éy‘é8dºXÀcf³…ÕSdñqcÆóÆŒÇHëÉŒüíÆŒédÆ"4ná(½ŒÃâEHu‡kRMõ3yØp1³Œ
,3Ù4ó–
V3ÁÙ°63!,‰ƒn6eBˆHvNCQF<“0…í¤œ¼½œs˜ìI: ü$œÂ’ÊI;¡¤¡ƒwRKé$žÐ§'ódwÄ“zBØÒÉ=ÁÉ\<É'„ì;¡šƒt²p%‰íæÉ?Í[&5p&5¸'5
œÔhb2N£²)ÛùÖ¼u§eó
;{›@v’7ñî\p6k§Œ³õ³\õ⨅)Ù“ƒ0o$U/à9b¹£ÐnV†2ñz<ø¸˜oqt û–9ƒJÇœ¾3Ã`ÑGx^&ÛY‚!“