pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/net



Module Name:    pkgsrc
Committed By:   jdolecek
Date:           Mon Jul 27 14:11:16 UTC 2020

Modified Files:
        pkgsrc/net: Makefile
Added Files:
        pkgsrc/net/py-xmm7360: DESCR Makefile PLIST distinfo
        pkgsrc/net/py-xmm7360/patches: patch-rpc_open_xdatachannel.py
            patch-rpc_rpc.py

Log Message:
Add package for the Python script needed to connect a Intel XMM7360 device
to network, from https://github.com/xmm7360/xmm7360-pci

There is no release for the master project, so base this on latest commit.


To generate a diff of this commit:
cvs rdiff -u -r1.1340 -r1.1341 pkgsrc/net/Makefile
cvs rdiff -u -r0 -r1.1 pkgsrc/net/py-xmm7360/DESCR \
    pkgsrc/net/py-xmm7360/Makefile pkgsrc/net/py-xmm7360/PLIST \
    pkgsrc/net/py-xmm7360/distinfo
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/net/py-xmm7360/patches/patch-rpc_open_xdatachannel.py \
    pkgsrc/net/py-xmm7360/patches/patch-rpc_rpc.py

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/net/Makefile
diff -u pkgsrc/net/Makefile:1.1340 pkgsrc/net/Makefile:1.1341
--- pkgsrc/net/Makefile:1.1340  Thu Jun 18 18:30:41 2020
+++ pkgsrc/net/Makefile Mon Jul 27 14:11:16 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1340 2020/06/18 18:30:41 bsiegert Exp $
+# $NetBSD: Makefile,v 1.1341 2020/07/27 14:11:16 jdolecek Exp $
 #
 
 COMMENT=       Networking tools
@@ -751,6 +751,7 @@ SUBDIR+=    py-twython
 SUBDIR+=       py-txamqp
 SUBDIR+=       py-txtorcon
 SUBDIR+=       py-xandikos
+SUBDIR+=       py-xmm7360
 SUBDIR+=       py-zeep
 SUBDIR+=       py-zeroconf
 SUBDIR+=       py-zmq

Added files:

Index: pkgsrc/net/py-xmm7360/DESCR
diff -u /dev/null pkgsrc/net/py-xmm7360/DESCR:1.1
--- /dev/null   Mon Jul 27 14:11:16 2020
+++ pkgsrc/net/py-xmm7360/DESCR Mon Jul 27 14:11:16 2020
@@ -0,0 +1,6 @@
+This package contains tool to connect Intel XMM7360 modem to mobile network.
+
+It requires the wwanc(4) driver to be present, and device nodes already
+created, for details see the manpage.
+
+open_xdatachannel.py must be run as root.
Index: pkgsrc/net/py-xmm7360/Makefile
diff -u /dev/null pkgsrc/net/py-xmm7360/Makefile:1.1
--- /dev/null   Mon Jul 27 14:11:16 2020
+++ pkgsrc/net/py-xmm7360/Makefile      Mon Jul 27 14:11:16 2020
@@ -0,0 +1,44 @@
+# $NetBSD: Makefile,v 1.1 2020/07/27 14:11:16 jdolecek Exp $
+
+DISTNAME=      xmm7360-0.20200727
+PKGNAME=       ${PYPKGPREFIX}-${DISTNAME}
+CATEGORIES=    net python
+MASTER_SITES=  ${MASTER_SITE_GITHUB:=xmm7360/}
+GITHUB_PROJECT=        xmm7360-pci
+GITHUB_TAG=    0060149958d00b9cec87b73cd610c136f69e5275
+
+MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=      https://github.com/xmm7360/xmm7360-pci
+COMMENT=       Network initialization for L850-GL / Intel XMM7360 driver
+LICENSE=       modified-bsd
+
+ONLY_FOR_PLATFORM=     NetBSD-*-* OpenBSD-*-*
+
+USE_LANGUAGES= # none
+
+DEPENDS+=      ${PYPKGPREFIX}-configargparse>=1.2.3:../../devel/py-configargparse
+
+NO_BUILD=       yes
+XMM_DIR=       ${PYSITELIB}/xmm7360
+
+PYTHON_VERSIONS_ACCEPTED=       37 38
+REPLACE_PYTHON=                 rpc/open_xdatachannel.py rpc/rpc.py
+INSTALLATION_DIRS+=             bin ${XMM_DIR}
+PY_PATCHPLIST=                  yes
+
+do-configure:
+       # XXX: Blank, but we can't define NO_CONFIGURE and use REPLACE_PYTHON...
+
+do-install:
+       ${INSTALL_SCRIPT} ${WRKSRC}/rpc/rpc.py \
+                ${DESTDIR}${PREFIX}/${XMM_DIR}/
+       ${INSTALL_SCRIPT} ${WRKSRC}/rpc/rpc_call_ids.py \
+                ${DESTDIR}${PREFIX}/${XMM_DIR}/
+       ${INSTALL_SCRIPT} ${WRKSRC}/rpc/rpc_unsol_table.py \
+                ${DESTDIR}${PREFIX}/${XMM_DIR}/
+       ${INSTALL_SCRIPT} ${WRKSRC}/rpc/open_xdatachannel.py \
+                ${DESTDIR}${PREFIX}/bin/open_xdatachannel.py
+
+.include "../../lang/python/application.mk"
+.include "../../lang/python/extension.mk"
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/net/py-xmm7360/PLIST
diff -u /dev/null pkgsrc/net/py-xmm7360/PLIST:1.1
--- /dev/null   Mon Jul 27 14:11:16 2020
+++ pkgsrc/net/py-xmm7360/PLIST Mon Jul 27 14:11:16 2020
@@ -0,0 +1,5 @@
+@comment $NetBSD: PLIST,v 1.1 2020/07/27 14:11:16 jdolecek Exp $
+bin/open_xdatachannel.py
+${PYSITELIB}/xmm7360/rpc.py
+${PYSITELIB}/xmm7360/rpc_call_ids.py
+${PYSITELIB}/xmm7360/rpc_unsol_table.py
Index: pkgsrc/net/py-xmm7360/distinfo
diff -u /dev/null pkgsrc/net/py-xmm7360/distinfo:1.1
--- /dev/null   Mon Jul 27 14:11:16 2020
+++ pkgsrc/net/py-xmm7360/distinfo      Mon Jul 27 14:11:16 2020
@@ -0,0 +1,8 @@
+$NetBSD: distinfo,v 1.1 2020/07/27 14:11:16 jdolecek Exp $
+
+SHA1 (xmm7360-0.20200727-0060149958d00b9cec87b73cd610c136f69e5275.tar.gz) = 4ca33e127d447584a81c5b28b1d74bb27a0d96f2
+RMD160 (xmm7360-0.20200727-0060149958d00b9cec87b73cd610c136f69e5275.tar.gz) = 03ecd54b2f44be3613aecc609fa8cfa0ba77fa02
+SHA512 (xmm7360-0.20200727-0060149958d00b9cec87b73cd610c136f69e5275.tar.gz) = 
d732a536d02dc68e6768e5687db74ac544b62c5ab57d25b8a7fa1270c2f38a855aa707c69f82a64ad08c87badc50837364deb1563b70da9aa74ef9f56d3cf547
+Size (xmm7360-0.20200727-0060149958d00b9cec87b73cd610c136f69e5275.tar.gz) = 24345 bytes
+SHA1 (patch-rpc_open_xdatachannel.py) = ba4c07aa4028716aea5d7b259c07afbda888dde0
+SHA1 (patch-rpc_rpc.py) = 17a614d4d9bc03d8d8f3b09f83d2eddfed7c5281

Index: pkgsrc/net/py-xmm7360/patches/patch-rpc_open_xdatachannel.py
diff -u /dev/null pkgsrc/net/py-xmm7360/patches/patch-rpc_open_xdatachannel.py:1.1
--- /dev/null   Mon Jul 27 14:11:16 2020
+++ pkgsrc/net/py-xmm7360/patches/patch-rpc_open_xdatachannel.py        Mon Jul 27 14:11:16 2020
@@ -0,0 +1,80 @@
+$NetBSD: patch-rpc_open_xdatachannel.py,v 1.1 2020/07/27 14:11:16 jdolecek Exp $
+
+--- rpc/open_xdatachannel.py.orig      2020-01-15 00:30:10.000000000 +0000
++++ rpc/open_xdatachannel.py
+@@ -4,11 +4,18 @@ import logging
+ # must do this before importing pyroute2
+ logging.basicConfig(level=logging.DEBUG)
+ 
+-import rpc
++from xmm7360 import rpc
+ import binascii
+ import time
+ import sys
+-from pyroute2 import IPRoute
++import os
++try:
++      from pyroute2 import IPRoute
++      ipr = IPRoute()
++      if not callable(getattr(ipr, 'link_lookup')):
++              ipr = None
++except:
++      ipr = None
+ 
+ import configargparse
+ 
+@@ -29,8 +36,6 @@ cfg = parser.parse_args()
+ 
+ r = rpc.XMMRPC()
+ 
+-ipr = IPRoute()
+-
+ r.execute('UtaMsSmsInit')
+ r.execute('UtaMsCbsInit')
+ r.execute('UtaMsNetOpen')
+@@ -72,26 +77,30 @@ logging.info("DNS server(s): " + ', '.jo
+ 
+ # For some reason, on IPv6 networks, the GetNegIpAddrReq call returns 8 bytes of the IPv6 address followed by our 4 byte IPv4 address.
+ # use the last nonzero IP
++ip_addr = None
+ for addr in ip_values[::-1]:
+     if addr.compressed != '0.0.0.0':
+         ip_addr = addr.compressed
+         break
+ 
+-idx = ipr.link_lookup(ifname='wwan0')[0]
+-
+-ipr.flush_addr(index=idx)
+-ipr.link('set',
+-        index=idx,
+-        state='up')
+-ipr.addr('add',
+-        index=idx,
+-        address=ip_addr)
+-
+-if not cfg.nodefaultroute:
+-    ipr.route('add',
+-            dst='default',
+-            priority=cfg.metric,
+-            oif=idx)
++if not ip_addr:
++      logging.info('No valid IP address, exiting')
++      sys.exit(1)
++
++if ipr:
++      idx = ipr.link_lookup(ifname='wwan0')[0]
++
++      ipr.flush_addr(index=idx)
++      ipr.link('set', index=idx, state='up')
++      ipr.addr('add', index=idx, address=ip_addr)
++
++      if not cfg.nodefaultroute:
++          ipr.route('add', dst='default',
++                  priority=cfg.metric,
++                  oif=idx)
++else:
++      os.system('ifconfig wwan0 %s' % (ip_addr))
++      os.system('route add default -iface %s' % (ip_addr))
+ 
+ # Add DNS values to /etc/resolv.conf
+ if not cfg.noresolv:
Index: pkgsrc/net/py-xmm7360/patches/patch-rpc_rpc.py
diff -u /dev/null pkgsrc/net/py-xmm7360/patches/patch-rpc_rpc.py:1.1
--- /dev/null   Mon Jul 27 14:11:16 2020
+++ pkgsrc/net/py-xmm7360/patches/patch-rpc_rpc.py      Mon Jul 27 14:11:16 2020
@@ -0,0 +1,42 @@
+$NetBSD: patch-rpc_rpc.py,v 1.1 2020/07/27 14:11:16 jdolecek Exp $
+
+--- rpc/rpc.py.orig    2020-01-15 00:30:10.000000000 +0000
++++ rpc/rpc.py
+@@ -7,8 +7,8 @@ import struct
+ import itertools
+ import ipaddress
+ import hashlib
+-import rpc_call_ids
+-import rpc_unsol_table
++from .rpc_call_ids import call_ids
++from .rpc_unsol_table import xmm7360_unsol
+ 
+ def asn_int4(val):
+     return b'\x02\x04' + struct.pack('>L', val)
+@@ -29,7 +29,7 @@ class XMMRPC(object):
+         desc = resp['type']
+ 
+         if resp['type'] == 'unsolicited':
+-            name = rpc_unsol_table.xmm7360_unsol.get(resp['code'], '0x%02x' % resp['code'])
++            name = xmm7360_unsol.get(resp['code'], '0x%02x' % resp['code'])
+             desc = 'unsolicited: %s' % name
+             self.handle_unsolicited(resp)
+ 
+@@ -107,7 +107,7 @@ class XMMRPC(object):
+         return {'tid': txid, 'type': t, 'code': code, 'body': body, 'content': content}
+ 
+     def handle_unsolicited(self, message):
+-        name = rpc_unsol_table.xmm7360_unsol.get(message['code'], None)
++        name = xmm7360_unsol.get(message['code'], None)
+ 
+         if name == 'UtaMsNetIsAttachAllowedIndCb':
+             self.attach_allowed = message['content'][2]
+@@ -322,7 +322,7 @@ def UtaModeSet(rpc, mode):
+     while True:
+         msg = rpc.pump()
+         # msg['txid'] will be mode_tid as well
+-        if rpc_unsol_table.xmm7360_unsol.get(msg['code'], None) == 'UtaModeSetRspCb':
++        if xmm7360_unsol.get(msg['code'], None) == 'UtaModeSetRspCb':
+             if msg['content'][0] != mode:
+                 raise IOError("UtaModeSet was not able to set mode. FCC lock enabled?")
+             return



Home | Main Index | Thread Index | Old Index