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

Compilation leads to error: use of undeclared identifier 'dwBytesRead' #9

Open
2ni opened this issue Feb 21, 2022 · 7 comments
Open

Comments

@2ni
Copy link
Collaborator

2ni commented Feb 21, 2022

Hi
Thanks for providing this code!
I tried to compile it on my mac:

git clone https://github.com/Polarisru/updiprog
cd updiprog; mkdir build; cd build
cmake
make

-> this leads to:
updiprog/com.c:201:10: error: use of undeclared identifier 'dwBytesRead'

Maybe you know why?
@Polarisru
Copy link
Owner

Polarisru commented Feb 22, 2022

Hello, this should be a problem with a Mac version probably. Nobody has built it yet and I see some problems in the UART processing code: I have only MINGW32 and __linux defines there, so I guess Mac doesn't know what to do. Unfortunately I don't have a Mac, so I can't find a solution for this issue :( You have to write some Mac code for writing and reading a serial port to make it possible.

@2ni
Copy link
Collaborator Author

2ni commented Feb 23, 2022

Hey, I found a solution, but I can't make a pull. For macs, you can use the same as for __linux.
So you can just replace all
#ifdef __linux
with
if defined(__APPLE__) || defined(__linux)

I also like to control RTS and DTR pins. Would it be possible to add a flag to set/clear rts and dts?
The code to eg clear RTS and set DTR would be as follows in com.c COM_Open() just after the open() command:

#include <sys/ioctl.h>
...

int RTS_flag;
RTS_flag = TIOCM_RTS;
ioctl(fd, TIOCMBIC, &RTS_flag); // TIOCMBIS: set, TIOCMBIC: clear
int DTR_flag;
DTR_flag = TIOCM_DTR;
ioctl(fd, TIOCMBIS, &DTR_flag); // TIOCMBIS: set, TIOCMBIC: clear

@Polarisru
Copy link
Owner

Can you make a pull request?
Yes, I can add these pins, what do you want to do with them? I am asking because of flags, how should I name them?

@2ni
Copy link
Collaborator Author

2ni commented Feb 23, 2022

ok, will do. I created a programmer which can switch between uart and updi on the same serial terminal connected to the computer. I use the DTR line to control if I use uart or updi on the mcu. For this reason I need to clear DTR and set RTS.
I was thinking of 2 additional parameters to set or clear dtr and rts (one for each). (-d and -r are already taken :-()

@2ni
Copy link
Collaborator Author

2ni commented Feb 23, 2022

could it be that I have no permissions to push?

~/updiprog support-mac-os ?1 ❯ git push -u origin support-mac-os                                                apricot 3.9.0
ERROR: Permission to Polarisru/updiprog.git denied to 2ni.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

@Polarisru
Copy link
Owner

I have sent you an invite, it will be probably possible to push to the repository directly after accepting it

@2ni
Copy link
Collaborator Author

2ni commented Feb 24, 2022

Thanks! Do you think I can re-use the argument onDTR to set DTR and clear RTS? I would also do a pull for it then

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

2 participants