Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnyTone D578UVII Uses Different USB VID and PID, Following Changes Read Radio #415

Open
ken-clifton opened this issue Feb 15, 2024 · 12 comments

Comments

@ken-clifton
Copy link

I noticed my AnyTone D578UVII uses different a different USB VID and PID than those defined near the top of anytone_interface.cc
Not sure of the best approach should you want to get QDMR working for both the "old" and "new" VID and PID ?
Here are the changes I implemented in 0.11 to successfully read from the radio:

  1. In /lib/anytone_interface.cc
    changed VID/PID to - VID: 2e3c PID: 5740

    Also in /lib/anytone_interface.cc
    Added line below:
    } else if ("D578UV" == _info.name) {
    return RadioInfo::byID(RadioInfo::D578UV);
    }

    As:
    else if ("D578UV2" == _info.name) {
    return RadioInfo::byID(RadioInfo::D578UVII);
    }

  2. In /lib/radioinfo.hh
    Below D878UVII,
    Added D578UVII,

    Also in /lib/radioinfo.hh
    below D578UVII,
    Added D578UV = D578UVII, // Actually a different device, Implement!

  3. In /lib/radioinfo.cc
    Below line: {"d578uv", RadioInfo::D578UV}
    Added: a comma ( , ) then on next line
    {"d578uv2", RadioInfo::D578UVII}

    Also in /lib/radioinfo.cc
    Below line: {RadioInfo::D578UV, D578UV::defaultRadioInfo()},
    Added:
    {RadioInfo::D578UVII, D578UV::defaultRadioInfo()},

  4. In /lib/radio.cc
    Below line: return new D578UV(anytone);
    Added:
    } else if ((id.isValid() && (RadioInfo::D578UVII == id.id())) || (force.isValid() && (RadioInfo::D578UVII == force.id()))) {
    return new D578UV(anytone);

  5. In /lib/d578uv.cc
    Changed the lines at the bottom below:
    RadioInfo
    D578UV::defaultRadioInfo() {
    return RadioInfo(

    To:
    RadioInfo::D578UVII, "d578uv2", "AT-D578UVII", "AnyTone", AnytoneInterface::interfaceInfo(),
    QList{
    RadioInfo(RadioInfo::D578UV, "d578uv", "AT-D578UV", "AnyTone", AnytoneInterface::interfaceInfo())
    });

@ken-clifton
Copy link
Author

Possible solution to above changes to support old Anytone VID/PID as well as new Anytone VID/PID:

  1. In /lib/anytone_interface.cc
    Changed #define USB_VID and USB_PID
    to:
    // original anytone vid & pid
    #define USB_VID1 0x28e9
    #define USB_PID1 0x018a

    And Added following two defines:
    // next are vid/pid for d578uv2
    #define USB_VID2 0x2e3c
    #define USB_PID2 0x5740

    Added a declaration for static variables above all methods near top:
    uint16_t AnytoneInterface::_at_vid = 0x0000;
    uint16_t AnytoneInterface::_at_pid = 0x0000;

    Modified AnytoneInterface::InterfaceInfo() and AnytoneInterface::detect() to
    USBDeviceInfo
    AnytoneInterface::interfaceInfo() {
    return USBDeviceInfo(USBDeviceInfo::Class::Serial, _at_vid, _at_pid);
    }

    QList
    AnytoneInterface::detect() {
    // try first usb_vid and usb_pid
    QList devices = USBSerial::detect(USB_VID1, USB_PID1);
    if (devices.count() == 1) {
    // device found...
    _at_vid = USB_VID1;
    _at_pid = USB_PID1;
    return devices;
    }
    else { // else try second usb_vid, usb_pid...
    _at_vid = USB_VID2; // save for use in AnytoneInterface::interfaceInfo()
    _at_pid = USB_PID2; // save for use in AnytoneInterface::interfaceInfo()
    return USBSerial::detect(USB_VID2, USB_PID2);
    }
    }

    Also in /lib/anytone_interface.cc
    Added line below:
    } else if ("D578UV" == _info.name) {
    return RadioInfo::byID(RadioInfo::D578UV);
    }

    As:
    else if ("D578UV2" == _info.name) {
    return RadioInfo::byID(RadioInfo::D578UVII);
    }

  2. in /lib/anytone_interface.hh
    near bottom of code in protected section just below RadioVariant _info; added
    static uint16_t _at_vid;
    static uint16_t _at_pid;

@galagithub
Copy link

This kind of bug is present on all radios where serial communication is used, why qdmr is masking this with USB ids is beyond me.

@allesand
Copy link

allesand commented Mar 17, 2024

@ken-clifton , @galagithub : Is this related to #196 and/or #370?

@ken-clifton
Copy link
Author

@allesand Yes, related to #196, but the code in the development branch does not handle the different USB VID and PID as mentioned in the title of this issue.

@allesand
Copy link

@ken-clifton : which of the models in https://www.wouxun.us/images/D578UV-Family.jpg is your radio? Or yet a different one?

@ken-clifton
Copy link
Author

@allesand in the image link you provided the radio is D578UVIII Plus. However if you read through both issue #196 and #415 it identifies itself in anytone_interface.cc code as "D578UV2". This is documented in the information I provided at the top of this issue as item 1 on Feb 14, 2024.

@allesand
Copy link

@ken-clifton : since the title of this issue reads "AnyTone D578UVII Uses Different USB VID and PID, Following Changes Read Radio" and also "I noticed my AnyTone D578UVII uses different a different USB VID and PID than those defined near the top of anytone_interface.cc" I just wanted to confirm that it is indeed a "D578UVIII Plus" according to that table and not yet another model Anytone came up with - since there is a "D578UVII" mentioned in https://www.wouxun.us/Software/AnyTone-Software/AT-D578UVII-PLUS-v2.06.2-Changelog.pdf ..

@ken-clifton
Copy link
Author

@allesand I appreciate you checking. Several of the AnyTone D578 series report as "D578UV2" in the USB information.

@allesand
Copy link

@allesand I appreciate you checking. Several of the AnyTone D578 series report as "D578UV2" in the USB information.

If different models with different options in the codeplug report the same model via USB, @hmatuschek will not be happy, since from what I understood Anytone does not encode the model in the data read from the radio. But I will leave that up to @hmatuschek, just wanted to gather as much info as possible.

@galagithub

This comment was marked as abuse.

@allesand
Copy link

Re: #285 and #389, end of discussion for me. @galagithub : good to read that you got a good laugh, maybe that will make your discussion more ham-spirit like. Side note: your "!" seems to be stuck.

@bbc581
Copy link

bbc581 commented Jul 4, 2024

allesand

This would do well to explain why I received the "No radio found: No matching device was found" information dialog upon attempting to detect my product in v0.11.2

I am using Distributor ID: Pop
Description: Pop!_OS 22.04 LTS
Release: 22.04
Codename: jammy

lsusb output

2e3c:5740 Artery AT32 Virtual Com Port

My Anytone AT-D578UV III Pro usually shows up around /dev/ttyACM0: USB ACM device

Probe in syslog
New USB device found, idVendor=2e3c, idProduct=5740, bcdDevice= 2.00
New USB device strings: Mfr=1, Product=2, SerialNumber=3

I would be more than happy to assist where I can with this issue. Would there be anything additional you need?

FYI, I am pretty sure the model I have uses the D578UV_1.20(AT) firmware. I am unsure how this will impact the complexity of the issue at hand but you may benefit from a file that was was included "Which firmware to use for D578UV.txt" of which the content below could be highly relevant:

  1. Due to the supply shortage on the microprocessors, D578UV has to use a different microprocessor after 1-July-2022.
  2. Check the Device Info for Firmware Version before the firmware upgrading.
  3. Firmware Ver: GD_Ver 1.XX, states the radio uses the GD MCU chip, it shall use the D578UV_GD_V1.XX version firmware for upgrade.
  4. Firmware Ver: AT_Ver 1.XX, states the radio use the AT MCU chip, it shall use the D578UV_AT_V1.XX version firmware for upgrade.
  5. When you select wrong firmware for loading, the CPS will report an error and remind to use the correct firmware.
  6. CPS is the same for both firmware version.

Hope this helps,

Chris WRUH997

@hmatuschek hmatuschek added this to the Version 0.12.2 milestone Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants