unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Network Manager
@ 2012-12-13 21:38 Ian D
  2012-12-13 21:47 ` Bastien
                   ` (4 more replies)
  0 siblings, 5 replies; 24+ messages in thread
From: Ian D @ 2012-12-13 21:38 UTC (permalink / raw)
  To: emacs-devel


Emacs Developers,

      I've been working on a network manager for Emacs.  It uses a
      backend, which at the moment is either NetworkManager or Wicd,
      which it accesses through D-Bus.  I haven't gotten it up to the
      Emacs Lisp Coding Standards, but it is functional, if anyone is
      interested.  As I am new to this mailing list, I'm not sure how I
      should send the source.

Ian D



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

* Re: Network Manager
  2012-12-13 21:38 Network Manager Ian D
@ 2012-12-13 21:47 ` Bastien
  2012-12-13 21:58   ` Ian D
  2012-12-13 21:51 ` Ian Bryant
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 24+ messages in thread
From: Bastien @ 2012-12-13 21:47 UTC (permalink / raw)
  To: Ian D; +Cc: emacs-devel

Hi Ian,

Ian D <dunni@gnu.org> writes:

> Emacs Developers,
>
>       I've been working on a network manager for Emacs.  It uses a
>       backend, which at the moment is either NetworkManager or Wicd,
>       which it accesses through D-Bus.  I haven't gotten it up to the
>       Emacs Lisp Coding Standards, but it is functional, if anyone is
>       interested.  As I am new to this mailing list, I'm not sure how I
>       should send the source.

Welcome on this list -- maybe first send a link pointing at the
code, so that people can test?  I use wicd and can test with this
manager.

Thanks!

-- 
 Bastien



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

* Re: Network Manager
  2012-12-13 21:38 Network Manager Ian D
  2012-12-13 21:47 ` Bastien
@ 2012-12-13 21:51 ` Ian Bryant
  2012-12-13 22:22 ` Xue Fuqiao
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 24+ messages in thread
From: Ian Bryant @ 2012-12-13 21:51 UTC (permalink / raw)
  To: Ian D; +Cc: emacs-devel

On Thu, 2012-12-13 at 16:38 -0500, Ian D wrote:
> As I am new to this mailing list, I'm not sure how I
>       should send the source.

I highly recommend starting a project on Savannah:

http://savannah.gnu.org/

This is the home of free and useful software.  I'd be very interested in
seeing your code in action.

Cheers.

-- 
Happy hacking,

Ian Bryant





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

* Re: Network Manager
  2012-12-13 21:47 ` Bastien
@ 2012-12-13 21:58   ` Ian D
  2012-12-13 22:19     ` Bastien
  0 siblings, 1 reply; 24+ messages in thread
From: Ian D @ 2012-12-13 21:58 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-devel

[-- Attachment #1: enwc.tar.gz --]
[-- Type: application/octet-stream, Size: 61440 bytes --]

[-- Attachment #2: Type: text/plain, Size: 577 bytes --]


        Unfortunately, I haven't gotten a chance to set it up anywhere,
        but here's the source.  It's only four files.  Wicd should be
        working pretty well, as it's the network manager I use.  I'm not
        sure how well NetworkManager will be working.  I know it can't
        setup profiles yet, as I haven't quite got that finished.  Let
        me know if there are any problems.

Ian D

Bastien <bzg@gnu.org> writes:

> ... maybe first send a link pointing at the
> code, so that people can test?  I use wicd and can test with this
> manager.
>
> Thanks!

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

* Re: Network Manager
  2012-12-13 21:58   ` Ian D
@ 2012-12-13 22:19     ` Bastien
  2012-12-18 17:45       ` Christian Lynbech
  0 siblings, 1 reply; 24+ messages in thread
From: Bastien @ 2012-12-13 22:19 UTC (permalink / raw)
  To: Ian D; +Cc: emacs-devel

Ian D <dunni@gnu.org> writes:

>         Unfortunately, I haven't gotten a chance to set it up
anywhere,

I can't ungzip the file...

-- 
 Bastien



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

* Re: Network Manager
  2012-12-13 21:38 Network Manager Ian D
  2012-12-13 21:47 ` Bastien
  2012-12-13 21:51 ` Ian Bryant
@ 2012-12-13 22:22 ` Xue Fuqiao
  2012-12-14  8:21 ` Michael Albinus
  2012-12-14 15:23 ` Richard Stallman
  4 siblings, 0 replies; 24+ messages in thread
From: Xue Fuqiao @ 2012-12-13 22:22 UTC (permalink / raw)
  To: Ian D; +Cc: emacs-devel

On Thu, 13 Dec 2012 16:38:39 -0500
Ian D <dunni@gnu.org> wrote:

>       I've been working on a network manager for Emacs.  It uses a
>       backend, which at the moment is either NetworkManager or Wicd,
>       which it accesses through D-Bus.  I haven't gotten it up to the
>       Emacs Lisp Coding Standards, but it is functional, if anyone is
>       interested.  As I am new to this mailing list, I'm not sure how I
>       should send the source.

If it is small, you can post it on ElispArea in EmacsWiki or gnu.emacs.sources.  If not, you can start a project on Savannah or create a website like gnus.org, orgmode.org and web-mode.org.

-- 
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao



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

* Re: Network Manager
@ 2012-12-13 22:56 Ian D
  2012-12-14  8:31 ` Bastien
  0 siblings, 1 reply; 24+ messages in thread
From: Ian D @ 2012-12-13 22:56 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-devel

[-- Attachment #1: enwc.tar.gz --]
[-- Type: application/x-gtar, Size: 11267 bytes --]

[-- Attachment #2: Type: text/plain, Size: 199 bytes --]


Bastien <bzg@gnu.org> writes:

> I can't ungzip the file...

  Sorry about that.  I forgot to tell tar to use gzip when zipping it.
  Here's something that should actually work... I checked!

Ian D

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

* Re: Network Manager
  2012-12-13 21:38 Network Manager Ian D
                   ` (2 preceding siblings ...)
  2012-12-13 22:22 ` Xue Fuqiao
@ 2012-12-14  8:21 ` Michael Albinus
  2012-12-14 13:45   ` Ian D
  2012-12-14 15:23 ` Richard Stallman
  4 siblings, 1 reply; 24+ messages in thread
From: Michael Albinus @ 2012-12-14  8:21 UTC (permalink / raw)
  To: Ian D; +Cc: emacs-devel

Ian D <dunni@gnu.org> writes:

> Emacs Developers,

Hi Ian,

>       I've been working on a network manager for Emacs.  It uses a
>       backend, which at the moment is either NetworkManager or Wicd,
>       which it accesses through D-Bus.  I haven't gotten it up to the
>       Emacs Lisp Coding Standards, but it is functional, if anyone is
>       interested.  As I am new to this mailing list, I'm not sure how I
>       should send the source.

It would be helpful, if you could explain in the ;;; Commentary: section,
that one needs to add to ~/.emacs

--8<---------------cut here---------------start------------->8---
(enwc-setup)
--8<---------------cut here---------------end--------------->8---

On an Ubuntu 12.04 machine, running NetworkManager 0.9.4.0, I get after
applying "M-x enwc-scan"

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (dbus-error "Method \"RequestScan\" with signature \"a{sv}\" on interface \"org.freedesktop.NetworkManager.Device.Wireless\" doesn't exist
")
  signal(dbus-error ("Method \"RequestScan\" with signature \"a{sv}\" on interface \"org.freedesktop.NetworkManager.Device.Wireless\" doesn't exist\n"))
  (progn (signal (car err) (cdr err)))
  (if (or dbus-debug (= dbus-message-type-error (nth 2 event))) (progn (signal (car err) (cdr err))))
  (condition-case err (let (result) (dbus-check-event event) (if (= dbus-message-type-error (nth 2 event)) (progn (signal (quote dbus-error) (nthcdr 9 event)))) (setq result (apply (nth 8 event) (nthcdr 9 event))) (if (= dbus-message-type-method-call (nth 2 event)) (progn (condition-case err (progn (if (eq result :ignore) (dbus-method-return-internal ... ... ...) (apply ... ... ... ... ...))) (dbus-error (if dbus-debug (progn ...))))))) (dbus-error (if (= dbus-message-type-method-call (nth 2 event)) (progn (condition-case err (progn (dbus-method-error-internal (nth 1 event) (nth 4 event) (nth 3 event) (cadr err))) (dbus-error (if dbus-debug (progn ...)))))) (run-hook-with-args (quote dbus-event-error-functions) event err) (if (or dbus-debug (= dbus-message-type-error (nth 2 event))) (progn
  (signal (car err) (cdr err))))))
  dbus-handle-event((dbus-event :system 3 3747 ":1.11" nil nil nil dbus-call-method-handler "Method \"RequestScan\" with signature \"a{sv}\" on interface \"org.freedesktop.NetworkManager.Device.Wireless\" doesn't exist\n"))
  call-interactively(dbus-handle-event nil [(dbus-event :system 3 3747 ":1.11" nil nil nil dbus-call-method-handler "Method \"RequestScan\" with signature \"a{sv}\" on interface \"org.freedesktop.NetworkManager.Device.Wireless\" doesn't exist\n")])
  read-event(nil nil 0.1)
  (let (unread-command-events) (read-event nil nil 0.1))
  (let ((event (let (unread-command-events) (read-event nil nil 0.1)))) (if (and event (not (condition-case nil (progn (dbus-check-event event)) (error nil)))) (progn (setq unread-command-events (append unread-command-events (list event))))))
  (while (eq (gethash key dbus-return-values-table :ignore) :ignore) (let ((event (let (unread-command-events) (read-event nil nil 0.1)))) (if (and event (not (condition-case nil (progn (dbus-check-event event)) (error nil)))) (progn (setq unread-command-events (append unread-command-events (list event)))))))
  (progn (while (eq (gethash key dbus-return-values-table :ignore) :ignore) (let ((event (let (unread-command-events) (read-event nil nil 0.1)))) (if (and event (not (condition-case nil (progn ...) (error nil)))) (progn (setq unread-command-events (append unread-command-events (list event))))))))
  (unwind-protect (progn (while (eq (gethash key dbus-return-values-table :ignore) :ignore) (let ((event (let (unread-command-events) (read-event nil nil 0.1)))) (if (and event (not (condition-case nil ... ...))) (progn (setq unread-command-events (append unread-command-events ...))))))) (cancel-timer -with-timeout-timer-))
  (let* ((-with-timeout-timer- (run-with-timer (if timeout (/ timeout 1000.0) 25) nil (function (lambda nil (throw (quote timeout) (quote timeout)))))) (with-timeout-timers (cons -with-timeout-timer- with-timeout-timers))) (unwind-protect (progn (while (eq (gethash key dbus-return-values-table :ignore) :ignore) (let ((event (let ... ...))) (if (and event (not ...)) (progn (setq unread-command-events ...)))))) (cancel-timer -with-timeout-timer-)))
  (catch (quote timeout) (let* ((-with-timeout-timer- (run-with-timer (if timeout (/ timeout 1000.0) 25) nil (function (lambda nil (throw ... ...))))) (with-timeout-timers (cons -with-timeout-timer- with-timeout-timers))) (unwind-protect (progn (while (eq (gethash key dbus-return-values-table :ignore) :ignore) (let ((event ...)) (if (and event ...) (progn ...))))) (cancel-timer -with-timeout-timer-))))
  (let ((-with-timeout-value- (catch (quote timeout) (let* ((-with-timeout-timer- (run-with-timer ... nil ...)) (with-timeout-timers (cons -with-timeout-timer- with-timeout-timers))) (unwind-protect (progn (while ... ...)) (cancel-timer -with-timeout-timer-)))))) (if (eq -with-timeout-value- (quote timeout)) (progn) -with-timeout-value-))
  (let ((timeout (plist-get args :timeout)) (key (apply (quote dbus-message-internal) dbus-message-type-method-call bus service path interface method (quote dbus-call-method-handler) args))) (let ((-with-timeout-value- (catch (quote timeout) (let* ((-with-timeout-timer- ...) (with-timeout-timers ...)) (unwind-protect (progn ...) (cancel-timer -with-timeout-timer-)))))) (if (eq -with-timeout-value- (quote timeout)) (progn) -with-timeout-value-)) (prog1 (gethash key dbus-return-values-table) (remhash key dbus-return-values-table)))
  dbus-call-method(:system "org.freedesktop.NetworkManager" "/org/freedesktop/NetworkManager/Devices/0" "org.freedesktop.NetworkManager.Device.Wireless" "RequestScan" :timeout 25000 (:array :signature "{sv}"))
  enwc-nm-scan()
  funcall(enwc-nm-scan)
  enwc-do-scan()
  (let* ((scan-ret (enwc-do-scan)) (enwc-access-points (enwc-get-nw)) (cur-id 0) networks) (message "Scanning... Done") (setq enwc-essid-width 5) (mapcar (function (lambda (x) (let ((ret-itm (cons ... nil))) (setq cur-id (1+ cur-id)) (progn (let (... det) (while --dolist-tail-- ... ... ...))) ret-itm))) enwc-access-points))
  enwc-scan-internal-wireless()
  (if enwc-using-wired (enwc-scan-internal-wired) (enwc-scan-internal-wireless))
  enwc-scan-internal()
  (setq enwc-last-scan (enwc-scan-internal))
  enwc-scan()
  call-interactively(enwc-scan record nil)
  command-execute(enwc-scan record)
  execute-extended-command(nil "enwc-scan")
  call-interactively(execute-extended-command nil nil)
--8<---------------cut here---------------end--------------->8---

The wireless card on "/org/freedesktop/NetworkManager/Devices/0" offers
an "org.freedesktop.NetworkManager.Device.Wireless" interface, but there
is no "RequestScan" method:

--8<---------------cut here---------------start------------->8---
(dbus-introspect-get-interface :system "org.freedesktop.NetworkManager"
 "/org/freedesktop/NetworkManager/Devices/0"
 "org.freedesktop.NetworkManager.Device.Wireless")

=> (interface ((name . org.freedesktop.NetworkManager.Device.Wireless))
     (method ((name . GetAccessPoints))
       (arg ((name . access_points) (type . ao) (direction . out))))
     (signal ((name . AccessPointRemoved))
       (arg ((type . o))))
     (signal ((name . AccessPointAdded))
       (arg ((type . o))))
     (signal ((name . PropertiesChanged))
       (arg ((type . a{sv}))))
     (property ((name . WirelessCapabilities) (type . u) (access . read)))
     (property ((name . ActiveAccessPoint) (type . o) (access . read)))
     (property ((name . Bitrate) (type . u) (access . read)))
     (property ((name . Mode) (type . u) (access . read)))
     (property ((name . PermHwAddress) (type . s) (access . read)))
     (property ((name . HwAddress) (type . s) (access . read))))
--8<---------------cut here---------------end--------------->8---

> Ian D

Best regards, Michael.



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

* Re: Network Manager
  2012-12-13 22:56 Ian D
@ 2012-12-14  8:31 ` Bastien
  2012-12-14  8:55   ` Michael Albinus
  0 siblings, 1 reply; 24+ messages in thread
From: Bastien @ 2012-12-14  8:31 UTC (permalink / raw)
  To: Ian D; +Cc: emacs-devel

Ian D <dunni@gnu.org> writes:

> Bastien <bzg@gnu.org> writes:
>
>> I can't ungzip the file...
>
>   Sorry about that.  I forgot to tell tar to use gzip when zipping it.
>   Here's something that should actually work... I checked!

Thanks for resending.

I tested M-x enwc RET after loading the four libraries and I get this
error:

Debugger entered--Lisp error: (void-function nil)
  nil()
  funcall(nil)
  enwc-do-scan()
  (let* ((scan-ret (enwc-do-scan)) (enwc-access-points (enwc-get-nw)) (cur-id 0) networks) (message "Scanning... Done") (setq enwc-essid-width 5) (mapcar (function (lambda (x) (let ((ret-itm (cons ... nil))) (setq cur-id (1+ cur-id)) (progn (let (... det) (while --dolist-tail-- ... ... ...))) ret-itm))) enwc-access-points))
  enwc-scan-internal-wireless()
  (if enwc-using-wired (enwc-scan-internal-wired) (enwc-scan-internal-wireless))
  enwc-scan-internal()
  (setq enwc-last-scan (enwc-scan-internal))
  enwc-scan()
  enwc()
  call-interactively(enwc record nil)
  command-execute(enwc record)
  execute-extended-command(nil "enwc")
  call-interactively(execute-extended-command nil nil)


-- 
 Bastien



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

* Re: Network Manager
  2012-12-14  8:31 ` Bastien
@ 2012-12-14  8:55   ` Michael Albinus
  2012-12-14  9:33     ` Bastien
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Albinus @ 2012-12-14  8:55 UTC (permalink / raw)
  To: Bastien; +Cc: Ian D, emacs-devel

Bastien <bzg@gnu.org> writes:

> I tested M-x enwc RET after loading the four libraries and I get this
> error:

You need to eval (enwc-setup) first.

Best regards, Michael.



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

* Re: Network Manager
  2012-12-14  8:55   ` Michael Albinus
@ 2012-12-14  9:33     ` Bastien
  0 siblings, 0 replies; 24+ messages in thread
From: Bastien @ 2012-12-14  9:33 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Ian D, emacs-devel

Michael Albinus <michael.albinus@gmx.de> writes:

>> I tested M-x enwc RET after loading the four libraries and I get this
>> error:
>
> You need to eval (enwc-setup) first.

This works, thanks.  

Then enwc seems to scan okay, but then my Emacs lags.

As Michael suggested, some help in the commentary section 
would actually be welcome!

-- 
 Bastien



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

* Re: Network Manager
  2012-12-14  8:21 ` Michael Albinus
@ 2012-12-14 13:45   ` Ian D
  2012-12-14 23:11     ` Stefan Monnier
  0 siblings, 1 reply; 24+ messages in thread
From: Ian D @ 2012-12-14 13:45 UTC (permalink / raw)
  To: emacs-devel



       A few things:

           1. I primarily use Wicd, so I haven't tested NetworkManager
           yet.

           2. The documentation I've been using for NetworkManager is
           for version 0.9.6.4, and in the NEWS file (and before anyone
           asks, I already checked the ChangeLog in the source I have)
           in the source code, I found that they indeed added
           RequestScan to NetworkManager in version 0.9.6.  The specific
           entry is "* Add on-demand WiFi scan support".  I will see
           what if there is anything I can do about this, although it
           seems like there isn't much.  However, 0.9.6 is the next
           version after 0.9.4, so I assume that the update will find
           its way to other distros soon.

           3. To anyone who hasn't ready any of the previous
           emails, you do need to add "(require 'enwc-setup)" and
           "(enwc-setup)" to your .emacs file.  I apologize for not
           mentioning this before, and have added it to the enwc.el
           file.

           4. When using Wicd, scanning does take a little while, since
           I needed it to block, otherwise the scan would complete in
           the background after ENWC finished it, so the displayed
           results would be invalid.  For me, it only takes a few
           seconds to complete the scan.

Ian D



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

* Re: Network Manager
@ 2012-12-14 14:01 Ian D
  2012-12-14 14:29 ` Michael Albinus
  2012-12-15 16:08 ` Michael Albinus
  0 siblings, 2 replies; 24+ messages in thread
From: Ian D @ 2012-12-14 14:01 UTC (permalink / raw)
  To: emacs-devel


       A few things:

           1. I primarily use Wicd, so I haven't tested NetworkManager
           yet.

           2. The documentation I've been using for NetworkManager is
           for version 0.9.6.4, and in the NEWS file (and before anyone
           asks, I already checked the ChangeLog in the source I have)
           in the source code, I found that they indeed added
           RequestScan to NetworkManager in version 0.9.6.  The specific
           entry is "* Add on-demand WiFi scan support".  I will see
           what if there is anything I can do about this, although it
           seems like there isn't much.  However, 0.9.6 is the next
           version after 0.9.4, so I assume that the update will find
           its way to other distros soon.

           3. To anyone who hasn't ready any of the previous
           emails, you do need to add "(require 'enwc-setup)" and
           "(enwc-setup)" to your .emacs file.  I apologize for not
           mentioning this before, and have added it to the enwc.el
           file.

           4. When using Wicd, scanning does take a little while, since
           I needed it to block, otherwise the scan would complete in
           the background after ENWC finished it, so the displayed
           results would be invalid.  For me, it only takes a few
           seconds to complete the scan.

Ian D



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

* Re: Network Manager
  2012-12-14 14:01 Ian D
@ 2012-12-14 14:29 ` Michael Albinus
  2012-12-15 16:08 ` Michael Albinus
  1 sibling, 0 replies; 24+ messages in thread
From: Michael Albinus @ 2012-12-14 14:29 UTC (permalink / raw)
  To: Ian D; +Cc: emacs-devel

Ian D <dunni@gnu.org> writes:

Hi Ian,

>            2. The documentation I've been using for NetworkManager is
>            for version 0.9.6.4, and in the NEWS file (and before anyone
>            asks, I already checked the ChangeLog in the source I have)
>            in the source code, I found that they indeed added
>            RequestScan to NetworkManager in version 0.9.6.  The specific
>            entry is "* Add on-demand WiFi scan support".  I will see
>            what if there is anything I can do about this, although it
>            seems like there isn't much.  However, 0.9.6 is the next
>            version after 0.9.4, so I assume that the update will find
>            its way to other distros soon.

Maybe your code could protect the respective D-Bus call with
`dbus-ignore-errors'. With this, wired connections might be visible at
least.

>            4. When using Wicd, scanning does take a little while, since
>            I needed it to block, otherwise the scan would complete in
>            the background after ENWC finished it, so the displayed
>            results would be invalid.  For me, it only takes a few
>            seconds to complete the scan.

What about `dbus-call-method-asynchronously'? The handler could update
the enwc buffer, and you aren't blocked during scan.

> Ian D

Best regards, Michael.



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

* Re: Network Manager
  2012-12-13 21:38 Network Manager Ian D
                   ` (3 preceding siblings ...)
  2012-12-14  8:21 ` Michael Albinus
@ 2012-12-14 15:23 ` Richard Stallman
  4 siblings, 0 replies; 24+ messages in thread
From: Richard Stallman @ 2012-12-14 15:23 UTC (permalink / raw)
  To: Ian D; +Cc: emacs-devel

That is an interesting project -- I might end up using it myself.

Is it asynchronous?  That is, can one go on editing while it makes a
connection?

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use Ekiga or an ordinary phone call




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

* Re: Network Manager
@ 2012-12-14 16:25 Ian D
  2012-12-16  9:07 ` Michael Albinus
  0 siblings, 1 reply; 24+ messages in thread
From: Ian D @ 2012-12-14 16:25 UTC (permalink / raw)
  To: emacs-devel


       Answers to next round of questions:

       > Maybe your code could protect the respective D-Bus call with
       > `dbus-ignore-errors'. With this, wired connections might be visible at
       > least.

       To use ENWC in wired mode, press 'W'.  I probably should have put
       that in the commentary.

       > What about `dbus-call-method-asynchronously'? The handler could update
       > the enwc buffer, and you aren't blocked during scan.

       I've tried that, but here's the problem with at least Wicd (Not
       so certain about NetworkManager):  The "Scan" function for Wicd
       takes a parameter `sync'.  This is `t' if the user wants a
       synchronous call, and `nil' otherwise.  The issues I ran into
       before were with this, and `dbus-call-method-asyncronously'
       doesn't really help with it.

       If `sync' is `nil', then the function returns `t', and goes
       into the background, but doesn't provide a way to see when the
       scan is finished.  It returns immediately, so
       `dbus-call-method-asynchronously' doesn't help.  If I try using
       `dbus-call-method-asynchronously' with `sync' as `t', then it
       just doesn't return until another call to "Scan" is made, which
       then compromises the return results

       > Is it asynchronous?  That is, can one go on editing while it makes a
       > connection?

       This part, there are no problems with (Again, not much testing
       with NetworkManager).  For Wicd, it begins connecting to the
       network, and disappears into the background.  For both of them
       (assuming that NetworkManager doesn't block during connection),
       the mode line string then switches to `[*%]', and will switch
       to the signal strength if it connects, or `[0%]' if it is not
       connected.  This allows the user to keep an eye on the connection
       status.

Ian D



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

* Re: Network Manager
  2012-12-14 13:45   ` Ian D
@ 2012-12-14 23:11     ` Stefan Monnier
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Monnier @ 2012-12-14 23:11 UTC (permalink / raw)
  To: Ian D; +Cc: emacs-devel

If you want, you can host your package in GNU ELPA (i.e. the source
code would be in the `elpa' branch).


        Stefan


>>>>> "Ian" == Ian D <dunni@rpi.edu> writes:

>        A few things:

>            1. I primarily use Wicd, so I haven't tested NetworkManager
>            yet.

>            2. The documentation I've been using for NetworkManager is
>            for version 0.9.6.4, and in the NEWS file (and before anyone
>            asks, I already checked the ChangeLog in the source I have)
>            in the source code, I found that they indeed added
>            RequestScan to NetworkManager in version 0.9.6.  The specific
>            entry is "* Add on-demand WiFi scan support".  I will see
>            what if there is anything I can do about this, although it
>            seems like there isn't much.  However, 0.9.6 is the next
>            version after 0.9.4, so I assume that the update will find
>            its way to other distros soon.

>            3. To anyone who hasn't ready any of the previous
>            emails, you do need to add "(require 'enwc-setup)" and
>            "(enwc-setup)" to your .emacs file.  I apologize for not
>            mentioning this before, and have added it to the enwc.el
>            file.

>            4. When using Wicd, scanning does take a little while, since
>            I needed it to block, otherwise the scan would complete in
>            the background after ENWC finished it, so the displayed
>            results would be invalid.  For me, it only takes a few
>            seconds to complete the scan.

> Ian D



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

* Re: Network Manager
  2012-12-14 14:01 Ian D
  2012-12-14 14:29 ` Michael Albinus
@ 2012-12-15 16:08 ` Michael Albinus
  1 sibling, 0 replies; 24+ messages in thread
From: Michael Albinus @ 2012-12-15 16:08 UTC (permalink / raw)
  To: Ian D; +Cc: emacs-devel

Ian D <dunni@gnu.org> writes:

>            2. The documentation I've been using for NetworkManager is
>            for version 0.9.6.4, and in the NEWS file (and before anyone
>            asks, I already checked the ChangeLog in the source I have)
>            in the source code, I found that they indeed added
>            RequestScan to NetworkManager in version 0.9.6.  The specific
>            entry is "* Add on-demand WiFi scan support".  I will see
>            what if there is anything I can do about this, although it
>            seems like there isn't much.  However, 0.9.6 is the next
>            version after 0.9.4, so I assume that the update will find
>            its way to other distros soon.

On another machine, running NetworkManager 0.9.6.0, I get

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (wrong-type-argument integerp "/org/freedesktop/NetworkManager/AccessPoint/141")
  nth("/org/freedesktop/NetworkManager/AccessPoint/141" ("/org/freedesktop/NetworkManager/AccessPoint/141" "/org/freedesktop/NetworkManager/AccessPoint/1"))
  (let ((ap (nth id enwc-access-points)) ret) (setq ret (dbus-get-property :system enwc-nm-dbus-service ap enwc-nm-dbus-accesspoint-interface prop)) (if (= prop "Frequency") (setq ret (1+ (/ (- ret 2412) 5)))) ret)
  enwc-nm-get-wireless-network-property("/org/freedesktop/NetworkManager/AccessPoint/141" "Ssid")
  funcall(enwc-nm-get-wireless-network-property "/org/freedesktop/NetworkManager/AccessPoint/141" "Ssid")
  enwc-get-wireless-nw-prop("/org/freedesktop/NetworkManager/AccessPoint/141" "Ssid")
  (let* ((cur-item (enwc-get-wireless-nw-prop x det)) (ident (enwc-detail-to-ident det)) pos-len) (if (string= ident "essid") (progn (setq pos-len (length cur-item)) (setq enwc-essid-width (max enwc-essid-width pos-len)))) (setq ret-itm (append ret-itm (cons (cons ident cur-item) nil))))
  (while --dolist-tail-- (setq det (car --dolist-tail--)) (let* ((cur-item (enwc-get-wireless-nw-prop x det)) (ident (enwc-detail-to-ident det)) pos-len) (if (string= ident "essid") (progn (setq pos-len (length cur-item)) (setq enwc-essid-width (max enwc-essid-width pos-len)))) (setq ret-itm (append ret-itm (cons (cons ident cur-item) nil)))) (setq --dolist-tail-- (cdr --dolist-tail--)))
  (let ((--dolist-tail-- enwc-details-list) det) (while --dolist-tail-- (setq det (car --dolist-tail--)) (let* ((cur-item (enwc-get-wireless-nw-prop x det)) (ident (enwc-detail-to-ident det)) pos-len) (if (string= ident "essid") (progn (setq pos-len (length cur-item)) (setq enwc-essid-width (max enwc-essid-width pos-len)))) (setq ret-itm (append ret-itm (cons (cons ident cur-item) nil)))) (setq --dolist-tail-- (cdr --dolist-tail--))))
  (progn (let ((--dolist-tail-- enwc-details-list) det) (while --dolist-tail-- (setq det (car --dolist-tail--)) (let* ((cur-item (enwc-get-wireless-nw-prop x det)) (ident (enwc-detail-to-ident det)) pos-len) (if (string= ident "essid") (progn (setq pos-len (length cur-item)) (setq enwc-essid-width (max enwc-essid-width pos-len)))) (setq ret-itm (append ret-itm (cons (cons ident cur-item) nil)))) (setq --dolist-tail-- (cdr --dolist-tail--)))))
  (let ((ret-itm (cons (cons "id" cur-id) nil))) (setq cur-id (1+ cur-id)) (progn (let ((--dolist-tail-- enwc-details-list) det) (while --dolist-tail-- (setq det (car --dolist-tail--)) (let* ((cur-item (enwc-get-wireless-nw-prop x det)) (ident (enwc-detail-to-ident det)) pos-len) (if (string= ident "essid") (progn (setq pos-len ...) (setq enwc-essid-width ...))) (setq ret-itm (append ret-itm (cons ... nil)))) (setq --dolist-tail-- (cdr --dolist-tail--))))) ret-itm)
  (lambda (x) (let ((ret-itm (cons (cons "id" cur-id) nil))) (setq cur-id (1+ cur-id)) (progn (let ((--dolist-tail-- enwc-details-list) det) (while --dolist-tail-- (setq det (car --dolist-tail--)) (let* ((cur-item ...) (ident ...) pos-len) (if (string= ident "essid") (progn ... ...)) (setq ret-itm (append ret-itm ...))) (setq --dolist-tail-- (cdr --dolist-tail--))))) ret-itm))("/org/freedesktop/NetworkManager/AccessPoint/141")
  mapcar((lambda (x) (let ((ret-itm (cons (cons "id" cur-id) nil))) (setq cur-id (1+ cur-id)) (progn (let ((--dolist-tail-- enwc-details-list) det) (while --dolist-tail-- (setq det (car --dolist-tail--)) (let* ((cur-item ...) (ident ...) pos-len) (if (string= ident "essid") (progn ... ...)) (setq ret-itm (append ret-itm ...))) (setq --dolist-tail-- (cdr --dolist-tail--))))) ret-itm)) ("/org/freedesktop/NetworkManager/AccessPoint/141" "/org/freedesktop/NetworkManager/AccessPoint/1"))
  (let* ((scan-ret (enwc-do-scan)) (enwc-access-points (enwc-get-nw)) (cur-id 0) networks) (message "Scanning... Done") (setq enwc-essid-width 5) (mapcar (function (lambda (x) (let ((ret-itm (cons ... nil))) (setq cur-id (1+ cur-id)) (progn (let (... det) (while --dolist-tail-- ... ... ...))) ret-itm))) enwc-access-points))
  enwc-scan-internal-wireless()
  (if enwc-using-wired (enwc-scan-internal-wired) (enwc-scan-internal-wireless))
  enwc-scan-internal()
  (setq enwc-last-scan (enwc-scan-internal))
  enwc-scan()
  enwc()
  call-interactively(enwc record nil)
  command-execute(enwc record)
  execute-extended-command(nil "enwc")
  call-interactively(execute-extended-command nil nil)
--8<---------------cut here---------------end--------------->8---

> Ian D

Best regards, Michael.



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

* Re: Network Manager
  2012-12-14 16:25 Ian D
@ 2012-12-16  9:07 ` Michael Albinus
  0 siblings, 0 replies; 24+ messages in thread
From: Michael Albinus @ 2012-12-16  9:07 UTC (permalink / raw)
  To: Ian D; +Cc: emacs-devel

Ian D <dunni@gnu.org> writes:

>        > What about `dbus-call-method-asynchronously'? The handler
>        > could update the enwc buffer, and you aren't blocked during
>        > scan.
>
>        I've tried that, but here's the problem with at least Wicd (Not
>        so certain about NetworkManager):  The "Scan" function for Wicd
>        takes a parameter `sync'.  This is `t' if the user wants a
>        synchronous call, and `nil' otherwise.  The issues I ran into
>        before were with this, and `dbus-call-method-asyncronously'
>        doesn't really help with it.
>
>        If `sync' is `nil', then the function returns `t', and goes
>        into the background, but doesn't provide a way to see when the
>        scan is finished.

There is the org.wicd.daemon.wireless.SendEndScanSignal signal, which
you could register for. In the corresponding handler, you could apply
needed actions.

> Ian D

Best regards, Michael.



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

* Re: Network Manager
@ 2012-12-17 12:39 Ian D
  0 siblings, 0 replies; 24+ messages in thread
From: Ian D @ 2012-12-17 12:39 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: enwc.tar.gz --]
[-- Type: application/x-gtar, Size: 47205 bytes --]

[-- Attachment #2: Type: text/plain, Size: 566 bytes --]


        So, while I'm waiting for Savannah to approve ENWC, I've
        attached an updated tarball, this time including the Makefile,
        and the changes I've been making.  Wicd now scans
        asynchronously, using the SendEndScanSignal signal to determine
        when to display the networks.  NetworkManager does something
        similar, but uses the AccessPointAdded and AccessPointRemoved
        signals, as that was all I could find.  I've also fixed up
        NetworkManager so that it can scan and display the results
        correctly.

Ian D

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

* Re: Network Manager
  2012-12-13 22:19     ` Bastien
@ 2012-12-18 17:45       ` Christian Lynbech
  0 siblings, 0 replies; 24+ messages in thread
From: Christian Lynbech @ 2012-12-18 17:45 UTC (permalink / raw)
  To: Bastien; +Cc: Ian D, emacs-devel

>>>>> "Bastien" == Bastien  <bzg@gnu.org> writes:

Bastien> I can't ungzip the file...

A little tip: with modern versions of GNU tar, you can just call

        tar xf <tarfile>

then gtar will figure out for itself whether it needs to do any
decompression. If you add "z" (or "j"), gtar will insist on running
gunzip (or bunzip).

At least this is what I see on Debian and elsewhere.


------------------------+-----------------------------------------------------
Christian Lynbech       | christian #\@ defun #\. dk
------------------------+-----------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - petonic@hal.com (Michael A. Petonic)



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

* Re: Network Manager
@ 2013-01-21 18:45 Ian D
  2013-01-22 18:24 ` Stefan Monnier
  0 siblings, 1 reply; 24+ messages in thread
From: Ian D @ 2013-01-21 18:45 UTC (permalink / raw)
  To: emacs-devel


    Sorry that it's taken me this long to send an update.  I got ENWC
    setup on savannah (https://savannah.nongnu.org/projects/enwc).  I
    also got it setup to work with NetworkManager.  I got it to connect
    to a network, and display the networks.  However, it takes a few
    seconds to display the networks after a scan, since it takes a while
    to get the network properties from an access point.  However,
    connecting seems to work welll.

Ian D



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

* Re: Network Manager
  2013-01-21 18:45 Ian D
@ 2013-01-22 18:24 ` Stefan Monnier
  2013-01-22 18:32   ` Ian D
  0 siblings, 1 reply; 24+ messages in thread
From: Stefan Monnier @ 2013-01-22 18:24 UTC (permalink / raw)
  To: Ian D; +Cc: emacs-devel

>     Sorry that it's taken me this long to send an update.  I got ENWC
>     setup on savannah (https://savannah.nongnu.org/projects/enwc).
>     I also got it setup to work with NetworkManager.  I got it to
>     connect to a network, and display the networks.  However, it takes
>     a few seconds to display the networks after a scan, since it takes
>     a while to get the network properties from an access point.
>     However, connecting seems to work welll.

I can't remember where the discussion went w.r.t including it in
GNU ELPA.  Were you interested?


        Stefan



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

* Re: Network Manager
  2013-01-22 18:24 ` Stefan Monnier
@ 2013-01-22 18:32   ` Ian D
  0 siblings, 0 replies; 24+ messages in thread
From: Ian D @ 2013-01-22 18:32 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

> I can't remember where the discussion went w.r.t including it in
> GNU ELPA.  Were you interested?
>
>
>         Stefan

          Yeah, that'd be great.  What's the usual procedure for doing
          so?

Ian D



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

end of thread, other threads:[~2013-01-22 18:32 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-13 21:38 Network Manager Ian D
2012-12-13 21:47 ` Bastien
2012-12-13 21:58   ` Ian D
2012-12-13 22:19     ` Bastien
2012-12-18 17:45       ` Christian Lynbech
2012-12-13 21:51 ` Ian Bryant
2012-12-13 22:22 ` Xue Fuqiao
2012-12-14  8:21 ` Michael Albinus
2012-12-14 13:45   ` Ian D
2012-12-14 23:11     ` Stefan Monnier
2012-12-14 15:23 ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2012-12-13 22:56 Ian D
2012-12-14  8:31 ` Bastien
2012-12-14  8:55   ` Michael Albinus
2012-12-14  9:33     ` Bastien
2012-12-14 14:01 Ian D
2012-12-14 14:29 ` Michael Albinus
2012-12-15 16:08 ` Michael Albinus
2012-12-14 16:25 Ian D
2012-12-16  9:07 ` Michael Albinus
2012-12-17 12:39 Ian D
2013-01-21 18:45 Ian D
2013-01-22 18:24 ` Stefan Monnier
2013-01-22 18:32   ` Ian D

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).