<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://truxwiki.com/index.php?action=history&amp;feed=atom&amp;title=TruxtonFileIO_newusb</id>
	<title>TruxtonFileIO newusb - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://truxwiki.com/index.php?action=history&amp;feed=atom&amp;title=TruxtonFileIO_newusb"/>
	<link rel="alternate" type="text/html" href="https://truxwiki.com/index.php?title=TruxtonFileIO_newusb&amp;action=history"/>
	<updated>2026-09-09T19:12:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://truxwiki.com/index.php?title=TruxtonFileIO_newusb&amp;diff=7206&amp;oldid=prev</id>
		<title>Sam: /* Sample */</title>
		<link rel="alternate" type="text/html" href="https://truxwiki.com/index.php?title=TruxtonFileIO_newusb&amp;diff=7206&amp;oldid=prev"/>
		<updated>2024-02-03T13:07:22Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Sample&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 13:07, 3 February 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l40&quot; &gt;Line 40:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 40:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;if __name__ == &amp;quot;__main__&amp;quot;:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;if __name__ == &amp;quot;__main__&amp;quot;:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   main()&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;sys.exit(&lt;/ins&gt;main(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;)&lt;/ins&gt;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sam</name></author>
		
	</entry>
	<entry>
		<id>https://truxwiki.com/index.php?title=TruxtonFileIO_newusb&amp;diff=1014&amp;oldid=prev</id>
		<title>Sam: Created page with &quot;This creates a new USB Device record from a file in Truxton. It automatically associates the parent file and media identifiers used in the USBDevice Table | USBDevice table....&quot;</title>
		<link rel="alternate" type="text/html" href="https://truxwiki.com/index.php?title=TruxtonFileIO_newusb&amp;diff=1014&amp;oldid=prev"/>
		<updated>2020-05-21T19:55:45Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This creates a new USB Device record from a file in Truxton. It automatically associates the parent file and media identifiers used in the USBDevice Table | USBDevice table....&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This creates a new USB Device record from a file in Truxton.&lt;br /&gt;
It automatically associates the parent file and media identifiers used in the [[USBDevice Table | USBDevice table.]]&lt;br /&gt;
&lt;br /&gt;
=Syntax=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
object newusb();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Return value=&lt;br /&gt;
A USB Device object&lt;br /&gt;
&lt;br /&gt;
=Sample=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Python&amp;quot; highlight=&amp;quot;16&amp;quot;&amp;gt;&lt;br /&gt;
import truxton&lt;br /&gt;
&lt;br /&gt;
from datetime import datetime&lt;br /&gt;
from calendar import timegm&lt;br /&gt;
&lt;br /&gt;
EPOCH_AS_FILETIME = 116444736000000000&lt;br /&gt;
HUNDREDS_OF_NANOSECONDS = 10000000&lt;br /&gt;
&lt;br /&gt;
def date_to_filetime(dt):&lt;br /&gt;
  return EPOCH_AS_FILETIME + (timegm(dt.timetuple()) * HUNDREDS_OF_NANOSECONDS)&lt;br /&gt;
&lt;br /&gt;
def main():&lt;br /&gt;
  t = truxton.create()&lt;br /&gt;
  file = t.getfileid(&amp;quot;5ec2a123-74d6-5da7-0653-4e6800000000&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
  usb = file.newusb()&lt;br /&gt;
&lt;br /&gt;
  usb.vendorid = 4100&lt;br /&gt;
  usb.productid = 25084&lt;br /&gt;
  usb.revision = 2&lt;br /&gt;
  usb.offset = 8193&lt;br /&gt;
  usb.when = date_to_filetime(datetime.utcnow())&lt;br /&gt;
&lt;br /&gt;
  if usb.save() is True:&lt;br /&gt;
    print( &amp;quot;New USB saved as &amp;quot; + usb.id )&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
  main()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sam</name></author>
		
	</entry>
</feed>