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

Support CY6C65215 and CY6C65215A #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

runger1101001
Copy link

@runger1101001 runger1101001 commented Dec 1, 2024

Support the dual channel devices. This is still a WIP.

This PR is to discuss the necessary changes to the scb_context, which are quite extensive.

Discussion on this topic also in PR #2

pass # TODO verbose output
else:
match(type):
case CyType.UART_CDC: # TODO we could have two of these!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to handle this case a little bit better in this function. I think what would make sense would be to add two DiscoveredDevice entries to the output when we see a dual channel device. Either that, or make DiscoveredDevice able to hold two different channels from one device.

@multiplemonomials
Copy link

I tried running cy_serial_cli scan with your branch, and I got:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/jamie/Mbed/cy_serial_bridge/src/cy_serial_bridge/cli.py:331 in scan                        │
│                                                                                                  │
│   328 │   Scan for candidate USB devices on the system                                           │
│   329 │   """                                                                                    │
│   330 │   scan_filter = None if scan_all else {(global_opt.vid, global_opt.pid)}                 │
│ ❱ 331 │   devices = context.list_devices(scan_filter)                                            │
│   332 │                                                                                          │
│   333 │   if len(devices) == 0:                                                                  │
│   334 │   │   if scan_all:                                                                       │
│                                                                                                  │
│ ╭─────────── locals ────────────╮                                                                │
│ │    scan_all = False           │                                                                │
│ │ scan_filter = {(1204, 57360)} │                                                                │
│ ╰───────────────────────────────╯                                                                │
│                                                                                                  │
│ /home/jamie/Mbed/cy_serial_bridge/src/cy_serial_bridge/cy_scb_context.py:206 in list_devices     │
│                                                                                                  │
│   203 │   │   │   │   │   │   │   scb_interface_settings = cfg[i][0]                             │
│   204 │   │   │   │   │   │   │   curr_cytype = CyType.UART_VENDOR                               │
│   205 │   │   │                                                                                  │
│ ❱ 206 │   │   │   if curr_cytype is None or mfg_interface_settings is None \                     │
│   207 │   │   │   │   or (scb_interface_settings is None and usb_cdc_interface_settings is Non   │
│   208 │   │   │   │   # TODO verbose output                                                      │
│   209 │   │   │   │   continue                                                                   │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ cdc_data_interface_settings = None                                                           │ │
│ │                         cfg = <usb1.USBConfiguration object at 0x7d84d0df81a0>               │ │
│ │                         dev = <usb1.USBDevice object at 0x7d84d054c110>                      │ │
│ │                 device_list = []                                                             │ │
│ │                even_vid_pid = (1204, 57360)                                                  │ │
│ │                           i = 1                                                              │ │
│ │      mfg_interface_settings = <usb1.USBInterfaceSetting object at 0x7d84d054c290>            │ │
│ │                 odd_vid_pid = (1204, 57361)                                                  │ │
│ │      scb_interface_settings = None                                                           │ │
│ │                        self = <cy_serial_bridge.cy_scb_context.CyScbContext object at        │ │
│ │                               0x7d84d05018b0>                                                │ │
│ │                        type = <CyType.MFG: 5>                                                │ │
│ │  usb_cdc_interface_settings = None                                                           │ │
│ │                    vid_pids = {(1204, 57360)}                                                │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
UnboundLocalError: cannot access local variable 'curr_cytype' where it is not associated with a value

@runger1101001
Copy link
Author

Hmmm - I'll look into this. I have worked on it in the last few days, and it's working on my side. But I have more changes I've done, so probably I've fixed this issue already.

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

Successfully merging this pull request may close these issues.

2 participants