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

hwdetect #5

Open
wants to merge 8 commits into
base: Mykhailo.Dehtiarov
Choose a base branch
from
Open

hwdetect #5

wants to merge 8 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Feb 2, 2020

Description

This script detects devices that were connected/disconnected.

Usage

Script runs in an infinite loop and prints out the name of the most recent device (as seen in /dev) and an indicator ("-->" - "connected", "<--" - "disconnected")

Example

$ ./hwdetect.sh
--> ttyUSB0
--> serial
--> sdc
--> sg2
--> sdc1
<-- serial
<-- ttyUSB0
<-- sdc
<-- sdc1
<-- sg2
^C

@ghost ghost added the ready for review label Feb 2, 2020
@ghost ghost requested a review from yekovalyov February 2, 2020 11:50
thegreatmike10 and others added 4 commits February 2, 2020 11:51
Signed-off-by: Dehtiarov Mykhailo <[email protected]>
The script shows the device's name form /dev and whether it was
connected or disconnected.

Signed-off-by: Dehtiarov Mykhailo <[email protected]>
The script now outputs an indicator ("-->" - connected, "<--" -
disconnected) and the device's name from /dev.

Signed-off-by: Dehtiarov Mykhailo <[email protected]>
@yekovalyov yekovalyov added enhancement New feature or request and removed ready for review labels Feb 3, 2020

start_log=$(ls /dev)

while true; do
Copy link
Contributor

Choose a reason for hiding this comment

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

This script will take 100% load of process. Please implement timeout. In my opinion 1 second is enough.

@ghost ghost changed the title Mykhailo.dehtiarov hwdetect Feb 8, 2020
@ghost ghost added question Further information is requested and removed enhancement New feature or request labels Feb 8, 2020
Dehtiarov Mykhailo added 3 commits February 8, 2020 13:43
Added 1s delay to lower process load.

Signed-off-by: Dehtiarov Mykhailo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant