operations: Added support for local device
This commit is contained in:
1 parent
e98891e52d
commit
cc8cca84ef
2 files changed
+69
-2
No files matched your search
+1
-1
@@ -4,7 +4,7 @@ CPPFLAGS += -DVERSION=\"$(VERSION)\" -D_GNU_SOURCE -I.
|
||||
CFLAGS += -W -Wall -Wno-unused-parameter -Wno-unused-result -O2 -pedantic -std=c99
|
||||
LIBS += -lm -lusb
|
||||
|
||||
OBJS = main.o nolo.o printf-utils.o image.o fiasco.o device.o usb-device.o cold-flash.o dump.o qmode.o console.o squeue/squeue.o operations.o
|
||||
OBJS = main.o nolo.o printf-utils.o image.o fiasco.o device.o usb-device.o cold-flash.o dump.o qmode.o console.o squeue/squeue.o operations.o local.o
|
||||
BIN = 0xFFFF
|
||||
|
||||
all: $(BIN)
|
||||
|
||||
+68
-1
@@ -22,6 +22,7 @@
|
||||
#include "usb-device.h"
|
||||
#include "cold-flash.h"
|
||||
#include "nolo.h"
|
||||
#include "local.h"
|
||||
|
||||
#include "operations.h"
|
||||
|
||||
@@ -35,7 +36,13 @@ struct device_info * dev_detect(void) {
|
||||
if ( ! dev )
|
||||
goto clean;
|
||||
|
||||
/* TODO: LOCAL */
|
||||
/* LOCAL */
|
||||
if ( local_init() == 0 ) {
|
||||
dev->method = METHOD_LOCAL;
|
||||
dev->detected_device = local_get_device();
|
||||
dev->detected_hwrev = local_get_hwrev();
|
||||
return dev;
|
||||
}
|
||||
|
||||
/* USB */
|
||||
usb = usb_open_and_wait_for_device();
|
||||
@@ -87,6 +94,9 @@ void dev_free(struct device_info * dev) {
|
||||
|
||||
enum device dev_get_device(struct device_info * dev) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_get_device();
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -182,6 +192,9 @@ int dev_boot_device(struct device_info * dev, const char * cmdline) {
|
||||
|
||||
int dev_reboot_device(struct device_info * dev) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_reboot_device();
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -200,6 +213,9 @@ int dev_reboot_device(struct device_info * dev) {
|
||||
|
||||
int dev_get_root_device(struct device_info * dev) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_get_root_device();
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -213,6 +229,9 @@ int dev_get_root_device(struct device_info * dev) {
|
||||
|
||||
int dev_set_root_device(struct device_info * dev, int device) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_set_root_device(device);
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -231,6 +250,9 @@ int dev_set_root_device(struct device_info * dev, int device) {
|
||||
|
||||
int dev_get_usb_host_mode(struct device_info * dev) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_get_usb_host_mode();
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -244,6 +266,9 @@ int dev_get_usb_host_mode(struct device_info * dev) {
|
||||
|
||||
int dev_set_usb_host_mode(struct device_info * dev, int enable) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_set_usb_host_mode(enable);
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -262,6 +287,9 @@ int dev_set_usb_host_mode(struct device_info * dev, int enable) {
|
||||
|
||||
int dev_get_rd_mode(struct device_info * dev) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_get_rd_mode();
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -275,6 +303,9 @@ int dev_get_rd_mode(struct device_info * dev) {
|
||||
|
||||
int dev_set_rd_mode(struct device_info * dev, int enable) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_set_rd_mode(enable);
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -293,6 +324,9 @@ int dev_set_rd_mode(struct device_info * dev, int enable) {
|
||||
|
||||
int dev_get_rd_flags(struct device_info * dev, char * flags, size_t size) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_get_rd_flags(flags, size);
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -306,6 +340,9 @@ int dev_get_rd_flags(struct device_info * dev, char * flags, size_t size) {
|
||||
|
||||
int dev_set_rd_flags(struct device_info * dev, const char * flags) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_set_rd_flags(flags);
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -324,6 +361,9 @@ int dev_set_rd_flags(struct device_info * dev, const char * flags) {
|
||||
|
||||
int16_t dev_get_hwrev(struct device_info * dev) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_get_hwrev();
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -337,6 +377,9 @@ int16_t dev_get_hwrev(struct device_info * dev) {
|
||||
|
||||
int dev_set_hwrev(struct device_info * dev, int16_t hwrev) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_set_hwrev(hwrev);
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -355,6 +398,9 @@ int dev_set_hwrev(struct device_info * dev, int16_t hwrev) {
|
||||
|
||||
int dev_get_kernel_ver(struct device_info * dev, char * ver, size_t size) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_get_kernel_ver(ver, size);
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -368,6 +414,9 @@ int dev_get_kernel_ver(struct device_info * dev, char * ver, size_t size) {
|
||||
|
||||
int dev_set_kernel_ver(struct device_info * dev, const char * ver) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_set_kernel_ver(ver);
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -386,6 +435,9 @@ int dev_set_kernel_ver(struct device_info * dev, const char * ver) {
|
||||
|
||||
int dev_get_nolo_ver(struct device_info * dev, char * ver, size_t size) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_get_nolo_ver(ver, size);
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -399,6 +451,9 @@ int dev_get_nolo_ver(struct device_info * dev, char * ver, size_t size) {
|
||||
|
||||
int dev_set_nolo_ver(struct device_info * dev, const char * ver) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_set_nolo_ver(ver);
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -417,6 +472,9 @@ int dev_set_nolo_ver(struct device_info * dev, const char * ver) {
|
||||
|
||||
int dev_get_sw_ver(struct device_info * dev, char * ver, size_t size) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_get_sw_ver(ver, size);
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -430,6 +488,9 @@ int dev_get_sw_ver(struct device_info * dev, char * ver, size_t size) {
|
||||
|
||||
int dev_set_sw_ver(struct device_info * dev, const char * ver) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_set_sw_ver(ver);
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -448,6 +509,9 @@ int dev_set_sw_ver(struct device_info * dev, const char * ver) {
|
||||
|
||||
int dev_get_content_ver(struct device_info * dev, char * ver, size_t size) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_get_content_ver(ver, size);
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
@@ -461,6 +525,9 @@ int dev_get_content_ver(struct device_info * dev, char * ver, size_t size) {
|
||||
|
||||
int dev_set_content_ver(struct device_info * dev, const char * ver) {
|
||||
|
||||
if ( dev->method == METHOD_LOCAL )
|
||||
return local_set_content_ver(ver);
|
||||
|
||||
if ( dev->method == METHOD_USB ) {
|
||||
|
||||
if ( dev->usb->flash_device->protocol == FLASH_NOLO )
|
||||
|
||||
Reference in new issue
Block a user