From 3274f9ba4b2f013aaee66a4afd2db8f165f83cd4 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 16 Jan 2013 12:41:33 +0100 Subject: scripts/osim-enter: Add script to extract component names from .osim --- scripts/osim-extract.py | 92 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100755 scripts/osim-extract.py (limited to 'scripts') diff --git a/scripts/osim-extract.py b/scripts/osim-extract.py new file mode 100755 index 0000000..e9686ec --- /dev/null +++ b/scripts/osim-extract.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# osim-extract.py -- Extract information from .osim file +# +# Copyright (C) 2013 Tobias Klauser +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +import os +import sys +import getopt +import xml.etree.ElementTree as ET + +def usage(): + print("""usage: {} [OPTION...] FILE + +options: + -b print only body names + -j print only joint names + -m print only muscle names + -v verbose mode + -h show this help and exit""".format(os.path.basname(sys.argv[0]))) + + +def main(): + try: + opts, args = getopt.getopt(sys.argv[1:], "bjmvh") + except getopt.GetoptError as err: + print(str(err)) + usage() + sys.exit(-1) + + do_print = { 'b': False, 'j': False, 'm': False } + verbose = False + for o, a in opts: + if o == '-b': + do_print['b'] = True; + elif o == '-j': + do_print['j'] = True; + elif o == '-m': + do_print['m'] = True; + elif o == '-v': + verbose = True + elif o == '-h': + usage() + sys.exit(0) + else: + assert False, "unhandled option" + + if len(args) < 1: + print("Error: no .osim model file specified") + usage() + sys.exit(-1) + + if not True in do_print.values(): + for k in do_print.iterkeys(): + do_print[k] = True + + try: + tree = ET.parse(args[0]) + except: + print("Error: failed to parse .osim model file") + sys.exit(-1) + + root = tree.getroot() + if verbose: + print("Found root with version {}".format(root.attrib['Version'])) + model = tree.find('Model') + if verbose: + print("Found model '{}'".format(model.attrib['name'])) + + if do_print['b']: + bodies = [ body.attrib['name'] for body in root.findall('Model/BodySet/objects/Body') ] + if verbose: + print("bodies:") + print(','.join(bodies)) + if do_print['j']: + joints = [ joint.attrib['name'] for joint in root.findall('Model/BodySet/objects/Body/Joint/*') ] + if verbose: + print("joints:") + print(','.join(joints)) + if do_print['m']: + muscles = [ force.attrib['name'] for force in root.findall('Model/ForceSet/objects/Thelen2003Muscle') ] + if verbose: + print("muscles:") + print(','.join(muscles)) + +if __name__ == '__main__': + main() -- cgit v1.2.3-54-g00ecf 25space:mode:
authorArchit Taneja <architt@codeaurora.org>2016-05-02 11:05:54 +0530
committerRob Clark <robdclark@gmail.com>2016-05-08 10:22:19 -0400
commit2b669875332fbdff0a7ad559e8662e875e7a1526 (patch)
tree7c506f5fa3771649d8c4918d632f763104c721ef
parent8208ed931eea9b00a3b29c9ef36da382b5480881 (diff)
drm/msm: Drop load/unload drm_driver ops
The load/unload drm_driver ops are deprecated. They should be removed as they result in creation of devices visible to userspace even before the drm_device is registered. Drop these ops and use drm_dev_alloc/register and drm_dev_unregister/unref to explicitly create and destroy the drm device in the msm platform driver's bind and unbind ops. With this in use, the drm connectors are only registered once the drm_device is registered. It also fixes the issue of stray debugfs files after the msm module is removed. With this, all the debugfs files are removed, and allows successive module insertions/removals. Signed-off-by: Archit Taneja <architt@codeaurora.org>