public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Does cygwin have an 'autorun' utility/package?
@ 2022-01-16 14:46 Mark Hansen
  2022-01-16 16:12 ` Adam Dinwoodie
  2022-01-26 14:37 ` Andrey Repin
  0 siblings, 2 replies; 5+ messages in thread
From: Mark Hansen @ 2022-01-16 14:46 UTC (permalink / raw)
  To: cygwin

I have an application running under Linux which I would like to move to Windows
(with Cygwin). This application depends on getting notifications when a CD Rom
drive status has changed (like audio CD inserted, ejected, etc.). For this, I
use a Linux utility application named 'autorun':

https://linux.die.net/man/1/autorun

What's nice about this application is it can be configured to send notifications when
various drive events occur.

I've looked through the package list for Cygwin and don't see anything like this.

Does Cygwin have anything that could work?

My Windows/C skills are about 20 years old so I was hoping to find an existing utility
application that can provide this functionality, rather than try write my own.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Does cygwin have an 'autorun' utility/package?
  2022-01-16 14:46 Does cygwin have an 'autorun' utility/package? Mark Hansen
@ 2022-01-16 16:12 ` Adam Dinwoodie
  2022-01-16 16:35   ` Mark Hansen
  2022-01-26 14:37 ` Andrey Repin
  1 sibling, 1 reply; 5+ messages in thread
From: Adam Dinwoodie @ 2022-01-16 16:12 UTC (permalink / raw)
  To: cygwin

On Sun, Jan 16, 2022 at 06:46:06AM -0800, Mark Hansen wrote:
> I have an application running under Linux which I would like to move to Windows
> (with Cygwin). This application depends on getting notifications when a CD Rom
> drive status has changed (like audio CD inserted, ejected, etc.). For this, I
> use a Linux utility application named 'autorun':
> 
> https://linux.die.net/man/1/autorun
> 
> What's nice about this application is it can be configured to send notifications when
> various drive events occur.
> 
> I've looked through the package list for Cygwin and don't see anything like this.
> 
> Does Cygwin have anything that could work?
> 
> My Windows/C skills are about 20 years old so I was hoping to find an existing utility
> application that can provide this functionality, rather than try write my own.

I don't think Cygwin has anything of this ilk. It's the sort of function
that inherently requires some integration with the underlying operating
system in ways that the Cygwin compatibility layer makes difficult:
a tool providing that sort of function on Cygwin would need to both
interface with the underlying Windows OS to get notifications of CD
drive events, then provide some sort of *nix-style interface for Cygwin
applications to attach to.

Depending on precisely what you need, you might be able to automate
things with a simple Bash/Python/whatever script.  Something like the
following would let you run a specific program when a CD is inserted
into drive D:, for example:

    #!/usr/bin/env bash
    set -eu
    while :; do
        if [[ -e /cygdrive/d ]]; then
            echo "CD detected, running '$PROGRAM'"
            cygstart "$PROGRAM"
        else
            echo 'No CD detected'
        fi
        sleep 60
    done

HTH

Adam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Does cygwin have an 'autorun' utility/package?
  2022-01-16 16:12 ` Adam Dinwoodie
@ 2022-01-16 16:35   ` Mark Hansen
  2022-01-16 17:59     ` Eliot Moss
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Hansen @ 2022-01-16 16:35 UTC (permalink / raw)
  To: cygwin

On 1/16/2022 8:12 AM, Adam Dinwoodie wrote:
> On Sun, Jan 16, 2022 at 06:46:06AM -0800, Mark Hansen wrote:
>> I have an application running under Linux which I would like to move to Windows
>> (with Cygwin). This application depends on getting notifications when a CD Rom
>> drive status has changed (like audio CD inserted, ejected, etc.). For this, I
>> use a Linux utility application named 'autorun':
>> 
>> https://linux.die.net/man/1/autorun
>> 
>> What's nice about this application is it can be configured to send notifications when
>> various drive events occur.
>> 
>> I've looked through the package list for Cygwin and don't see anything like this.
>> 
>> Does Cygwin have anything that could work?
>> 
>> My Windows/C skills are about 20 years old so I was hoping to find an existing utility
>> application that can provide this functionality, rather than try write my own.
> 
> I don't think Cygwin has anything of this ilk. It's the sort of function
> that inherently requires some integration with the underlying operating
> system in ways that the Cygwin compatibility layer makes difficult:
> a tool providing that sort of function on Cygwin would need to both
> interface with the underlying Windows OS to get notifications of CD
> drive events, then provide some sort of *nix-style interface for Cygwin
> applications to attach to.
> 
> Depending on precisely what you need, you might be able to automate
> things with a simple Bash/Python/whatever script.  Something like the
> following would let you run a specific program when a CD is inserted
> into drive D:, for example:
> 
>      #!/usr/bin/env bash
>      set -eu
>      while :; do
>          if [[ -e /cygdrive/d ]]; then
>              echo "CD detected, running '$PROGRAM'"
>              cygstart "$PROGRAM"
>          else
>              echo 'No CD detected'
>          fi
>          sleep 60
>      done
> 
> HTH
> 
> Adam
> 

Thanks. I need to know specifically when an Audio CD is inserted. I guess I'll keep
looking. Thanks.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Does cygwin have an 'autorun' utility/package?
  2022-01-16 16:35   ` Mark Hansen
@ 2022-01-16 17:59     ` Eliot Moss
  0 siblings, 0 replies; 5+ messages in thread
From: Eliot Moss @ 2022-01-16 17:59 UTC (permalink / raw)
  To: Mark Hansen, cygwin

inotify is a POSIX library that would help meet the need.
It apparently has not been ported to Cygwin as a regular
package, though Windows has the necessary underlying ability.

However, this suggests that you can fairly easily build a
program to help:

https://github.com/thekid/inotify-win

It seems to build and work reasonably well.

Another angle is this Qt library (though I am not sure if it
works under Cygwin):

https://doc.qt.io/qt-5/qfilesystemwatcher.html

Best - Eliot Moss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Does cygwin have an 'autorun' utility/package?
  2022-01-16 14:46 Does cygwin have an 'autorun' utility/package? Mark Hansen
  2022-01-16 16:12 ` Adam Dinwoodie
@ 2022-01-26 14:37 ` Andrey Repin
  1 sibling, 0 replies; 5+ messages in thread
From: Andrey Repin @ 2022-01-26 14:37 UTC (permalink / raw)
  To: Mark Hansen, cygwin

Greetings, Mark Hansen!

> I have an application running under Linux which I would like to move to Windows
> (with Cygwin). This application depends on getting notifications when a CD Rom
> drive status has changed (like audio CD inserted, ejected, etc.). For this, I
> use a Linux utility application named 'autorun':

> https://linux.die.net/man/1/autorun

> What's nice about this application is it can be configured to send notifications when
> various drive events occur.

> I've looked through the package list for Cygwin and don't see anything like this.

Check out http://www.uwe-sieber.de/usbdlm_e.html

This is no Cygwin app, but it's nonetheless a very powerful app that can deal
in various drive events.

> Does Cygwin have anything that could work?

> My Windows/C skills are about 20 years old so I was hoping to find an existing utility
> application that can provide this functionality, rather than try write my own.


-- 
With best regards,
Andrey Repin
Wednesday, January 26, 2022 17:37:09

Sorry for my terrible english...


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-26 14:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-16 14:46 Does cygwin have an 'autorun' utility/package? Mark Hansen
2022-01-16 16:12 ` Adam Dinwoodie
2022-01-16 16:35   ` Mark Hansen
2022-01-16 17:59     ` Eliot Moss
2022-01-26 14:37 ` Andrey Repin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).