Skip to contentSkip to conversation

Waiting complete insertion of usb device

DISCUSSION Anthony Viallard 2 participants 4 messages Sep 15, 2009 – Sep 16, 2009

lore
Share & tools
lore
#0 lore raw

Hello list,

I'm working on a 3G USB dongle which offer tty to communicate with him.

I need to start a service when this dongle is plugged to my system. This service uses tty (there are 4 tty (diag, cmd, data and for voice). So, i need to waiting the complete insertion of the USB dongle before launching it.

For now, i'm waiting the last tty (ttyUSB3) event, sleep 1 second and launch the service. But i think my solution is pretty crap.

Is there a better way to do this ?

(I'm working with old architecture of hotplug: /bin/hotplug script which launch /etc/hotplug.d/${SUBSYSTEM}/ scripts...)

Anthony.

#1 lore raw
Quoted 9 lines · Anthony Viallard

Hello list,

I'm working on a 3G USB dongle which offer tty to communicate with him.

I need to start a service when this dongle is plugged to my system. This service uses tty (there are 4 tty (diag, cmd, data and for voice). So, i need to waiting the complete insertion of the USB dongle before launching it.

Quoted 7 lines

For now, i'm waiting the last tty (ttyUSB3) event, sleep 1 second and launch the service. But i think my solution is pretty crap.

Is there a better way to do this ?

(I'm working with old architecture of hotplug: /bin/hotplug script which launch /etc/hotplug.d/${SUBSYSTEM}/ scripts...)

That architecture is obsolete, and is not shipped, or supported by any distro or developer, so you are on your own if you want to rely and use it.

good luck,

greg k-h

#2 lore raw
In reply to Anthony Viallard
Quoted 14 lines · Greg KH
Quoted 12 lines · Anthony Viallard

Hello list,

I'm working on a 3G USB dongle which offer tty to communicate with him.

I need to start a service when this dongle is plugged to my system. This service uses tty (there are 4 tty (diag, cmd, data and for voice). So, i need to waiting the complete insertion of the USB dongle before launching it.

For now, i'm waiting the last tty (ttyUSB3) event, sleep 1 second and launch the service. But i think my solution is pretty crap.

Quoted 10 lines
Quoted 5 lines

Is there a better way to do this ?

(I'm working with old architecture of hotplug: /bin/hotplug script which launch /etc/hotplug.d/${SUBSYSTEM}/ scripts...)

That architecture is obsolete, and is not shipped, or supported by any distro or developer, so you are on your own if you want to rely and use it.

do you mean my problem will be solved if i use udev ?

#3 lore raw
In reply to Anthony Viallard
Quoted 20 lines · Anthony Viallard
Quoted 19 lines · Greg KH
Quoted 17 lines · Anthony Viallard

Hello list,

I'm working on a 3G USB dongle which offer tty to communicate with him.

I need to start a service when this dongle is plugged to my system. This service uses tty (there are 4 tty (diag, cmd, data and for voice). So, i need to waiting the complete insertion of the USB dongle before launching it.

For now, i'm waiting the last tty (ttyUSB3) event, sleep 1 second and launch the service. But i think my solution is pretty crap.

Is there a better way to do this ?

(I'm working with old architecture of hotplug: /bin/hotplug script which launch /etc/hotplug.d/${SUBSYSTEM}/ scripts...)

Quoted 6 lines
Quoted 5 lines

That architecture is obsolete, and is not shipped, or supported by any distro or developer, so you are on your own if you want to rely and use it.

do you mean my problem will be solved if i use udev ?

It will make things easier, yes.