Difference between revisions of "Truxton file create usb"
Jump to navigation
Jump to search
(Created page with "This creates a USB device object sourced from this file that you can use in the USB Device Visit API. A USB object is how you add records to the...") |
|||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
This creates a USB device object sourced from this file that you can use in the [[Truxton C API#USB Device | USB Device Visit API.]] | This creates a USB device object sourced from this file that you can use in the [[Truxton C API#USB Device | USB Device Visit API.]] | ||
| − | A USB object is how you add records to the <code>[[USBDevice Table | USBDevice]]</code> table. | + | A USB object is how you add records to the <code><nowiki>[</nowiki>[[USBDevice Table|USBDevice]]<nowiki>]</nowiki></code> table. |
The resulting object will automatically be associated with the file it was created from and with the media the file belongs to. | The resulting object will automatically be associated with the file it was created from and with the media the file belongs to. | ||
=Syntax= | =Syntax= | ||
| − | < | + | <source lang="C"> |
uint64_t truxton_file_create_usb( uint64_t file_handle ); | uint64_t truxton_file_create_usb( uint64_t file_handle ); | ||
| − | </ | + | </source> |
=Parameters= | =Parameters= | ||
| Line 16: | Line 16: | ||
=Sample= | =Sample= | ||
| − | < | + | <source lang="C" highlight="5"> |
| − | void process_file(uint64_t truxton) | + | void process_file( uint64_t truxton ) |
{ | { | ||
| − | uint64_t file = truxton_file_open_md5(truxton, "9ec8fb6095c35eff2b236863b7caaf10"); | + | uint64_t file = truxton_file_open_md5( truxton, "9ec8fb6095c35eff2b236863b7caaf10" ); |
| − | uint64_t usb = truxton_file_create_usb(file); | + | uint64_t usb = truxton_file_create_usb( file ); |
| − | truxton_usb_set_vendor_id(usb, 0x1234); | + | truxton_usb_set_vendor_id( usb, 0x1234 ); |
| − | truxton_usb_set_product_id(usb, 0x5678); | + | truxton_usb_set_product_id( usb, 0x5678 ); |
| − | truxton_usb_set_when(usb, truxton_file_get_modified( file ) ); | + | truxton_usb_set_when( usb, truxton_file_get_modified( file ) ); |
| − | truxton_usb_save(usb); | + | truxton_usb_save( usb ); |
| − | truxton_usb_destroy(usb); | + | truxton_usb_destroy( usb ); |
| − | + | truxton_file_free( file ); | |
} | } | ||
| − | </ | + | </source> |
Latest revision as of 05:00, 13 February 2021
This creates a USB device object sourced from this file that you can use in the USB Device Visit API.
A USB object is how you add records to the [USBDevice] table.
The resulting object will automatically be associated with the file it was created from and with the media the file belongs to.
Syntax
uint64_t truxton_file_create_usb( uint64_t file_handle );
Parameters
file_handle
The handle created by the truxton_file_open_id or truxton_file_open_md5 call.
Return value
A handle to a USB device object.
Sample
void process_file( uint64_t truxton )
{
uint64_t file = truxton_file_open_md5( truxton, "9ec8fb6095c35eff2b236863b7caaf10" );
uint64_t usb = truxton_file_create_usb( file );
truxton_usb_set_vendor_id( usb, 0x1234 );
truxton_usb_set_product_id( usb, 0x5678 );
truxton_usb_set_when( usb, truxton_file_get_modified( file ) );
truxton_usb_save( usb );
truxton_usb_destroy( usb );
truxton_file_free( file );
}