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

check does tty busy before use it #2

Open
AndreiCherniaev opened this issue Aug 20, 2022 · 0 comments
Open

check does tty busy before use it #2

AndreiCherniaev opened this issue Aug 20, 2022 · 0 comments

Comments

@AndreiCherniaev
Copy link
Owner

AndreiCherniaev commented Aug 20, 2022

See example
lsof -PFp -w /dev/ttyUSB0 || avrdude -c arduino -p atmega2560 -cwiring -P /dev/ttyUSB0 -b115200 -D -Uflash:w:"/home/a/Documents/TirBoxProj/supervisor/FreeRTOS/Demo/FreeRTOS_ATmega2560_MPLAB.X/dist/default/production/FreeRTOS_ATmega2560_MPLAB.X.production.hex"
here I try to get lsof output. If no output so tty isn't busy. If tty isn't busy, lsof return not 0, so I can use || to check.

I also want to use variable instead of use /dev/ttyUSB0 twice. I try
export t="/dev/ttyUSB0" && lsof -PFp -w ${t} || avrdude -c arduino -p atmega2560 -cwiring -P ${t} -b115200 -D -Uflash:w:"/home/a/Documents/TirBoxProj/supervisor/FreeRTOS/Demo/FreeRTOS_ATmega2560_MPLAB.X/dist/default/production/FreeRTOS_ATmega2560_MPLAB.X.production.hex"
but it doesn't work in MPLAB (Execute this line after build). But works well in linux console Why?

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

1 participant